R: tidytext data frame: Difference between revisions
From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs) Created page with " # text asli # text <- c("Because I could not stop for Death -", "He kindly stopped for me -", "The Carriage held but just Ourselves -", "a..." |
Onnowpurbo (talk | contribs) No edit summary |
||
| Line 13: | Line 13: | ||
text_df <- data_frame(line = 1:4, text = text) | text_df <- data_frame(line = 1:4, text = text) | ||
text_df | text_df | ||
# konversi menjadi token | |||
# | |||
library(tidytext) | |||
text_df %>% | |||
unnest_tokens(word, text) | |||
Revision as of 02:23, 6 November 2018
# text asli
#
text <- c("Because I could not stop for Death -",
"He kindly stopped for me -",
"The Carriage held but just Ourselves -",
"and Immortality")
text
# konversi ke data fame # library(dplyr) text_df <- data_frame(line = 1:4, text = text) text_df
# konversi menjadi token # library(tidytext) text_df %>% unnest_tokens(word, text)