Difference between revisions of "R: tidytext data frame"

From OnnoWiki
Jump to navigation Jump to search
(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...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
Flow Chart
 +
 +
[[File:Tidytext-flowchart.png|center|400px|thumb]]
 +
  
 
  # text asli
 
  # text asli
Line 13: Line 17:
 
  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)
  
  

Latest revision as of 09:27, 6 November 2018

Flow Chart

Tidytext-flowchart.png


# 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)


Pranala Menarik