-
-
Save Chuyakova/4069406559e2d42af476aa713e13e6bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(fmsb) | |
df <- read_csv("imdb_top_250_sentiments.csv", col_types = c(col_character(), | |
col_character(), | |
col_double(), | |
col_double(), | |
col_character(), | |
col_character())) | |
counts <- as.data.frame(table(df$Overall_sentiment)) | |
p<-ggplot(data=counts, aes(x=Var1, y=Freq)) + | |
geom_bar(stat="identity") + | |
xlab("Overall sentiment of storyline") + | |
ylab("Frequency") | |
p | |
histogram_maker <- function(column, xlabel) { | |
p <- ggplot() + aes(column) + | |
geom_histogram() + | |
xlab(xlabel) | |
return(p) | |
} | |
# Could be called with Positive and Negative as well. | |
p <- histogram_maker(df$Neutral, "Neutral") | |
ggsave("Neutral_histo.png", p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment