R: tidytext RPJP BAPPENAS: Difference between revisions
From OnnoCenterWiki
Jump to navigationJump to search
Onnowpurbo (talk | contribs) No edit summary |
Onnowpurbo (talk | contribs) No edit summary |
||
| Line 12: | Line 12: | ||
tidy() %>% | tidy() %>% | ||
filter(!grepl("[0-9]+", term)) | filter(!grepl("[0-9]+", term)) | ||
# converted adalah DocumentTermMatrix | |||
original_converted <- converted %>% | |||
group_by(document) %>% | |||
ungroup() | |||
original_converted | |||
Revision as of 05:29, 6 November 2018
library(tidyverse)
library(tidytext)
library(tm)
directory <- "data-pdf"
# create corpus from pdfs
converted <- VCorpus(DirSource(directory), readerControl = list(reader = readPDF)) %>%
DocumentTermMatrix()
converted %>%
tidy() %>%
filter(!grepl("[0-9]+", term))
# converted adalah DocumentTermMatrix
original_converted <- converted %>% group_by(document) %>% ungroup() original_converted