Last active
January 27, 2018 15:06
-
-
Save tomer-ben-david/bd9b1433a79072d2c04e1dae4d1d6b2d to your computer and use it in GitHub Desktop.
create matrix table r and plot load dataframe #R
This file contains hidden or 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
df <- data.frame(x=c("spam", "spam", "ham"), y=c("some mail", "some other mail", "some third mail")) | |
names(df) <- c("Label", "Text") | |
df$Label <- as.factor(df$Label) // Fill by label would not work if not factor. | |
df$TextLength <- nchar(as.character(df$Text)) | |
View(df) | |
ggplot(df, aes(x = TextLength, fill = Label)) + theme_bw() + | |
geom_histogram(binwidth = 5) + | |
labs(y = "Text Count", x = "Length of Text", title = "Distribution of text on labels") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment