Skip to content

Commit dd5ef55

Browse files
authored
adjustments
included creation of output folder and fixed paths
1 parent dea1865 commit dd5ef55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scripts/workshop_package/scripts_sentiment_analysis.qmd

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,13 @@ library(stringr)
3333

3434
```{r}
3535
# Load Data
36-
comments <- readr::read_csv("./data/comments_preprocessed.csv")
36+
comments <- readr::read_csv("./data/clean/comments_preprocessed.csv")
3737
3838
# Compute sentiment per row/case
3939
40+
```{r}
41+
```
42+
4043
# Add scores and labels to original dataset
4144
polarity <- comments %>%
4245
mutate(score = sentiment_scores$ave_sentiment,
@@ -47,10 +50,12 @@ polarity <- comments %>%
4750
))
4851

4952
# Check first rows with results
50-
53+
```{r}
54+
```
5155

5256
# Scores per label
5357

58+
```{r}
5459
```
5560

5661
#### Plotting
@@ -79,6 +84,7 @@ ggplot(polarity_seasons, aes(x = score, fill = season)) +
7984
scale_fill_brewer(palette = "Set1")
8085
8186
# Save results
87+
dir.create("output", recursive = TRUE, showWarnings = FALSE) #create dir
8288
write_csv(polarity, "output/polarity_results.csv")
8389
```
8490

0 commit comments

Comments
 (0)