I have recently learned how to pick a single CSV file and find the most commonly used words in the file using text mining in R. What I would now like to do is to have R search through multiple CSV files (in my example I have 5) and pick out similar words that appear in each CSV file. FYI - in my 5 files, I've artificially inserted the word "hieroglyphics", and I would like my code to be able to pull this out as a matching word across all 5 files, along with any other words that match across all 5 documents.
I've set up the code as follows below, but am really struggling with how to proceed. Can anyone help?
Many thanks in advance,
Paul
P.S. As an extension (if the above is too easy for some of you!) - is there a way that you can pull out the number of the 5 CSV files that contain a word? Continuing the above example, if the word "Egypt" was only contained in 4 of the 5 CSV files, could R program to pull out every word and say "hieroglypics - 5", "Egypt - 4", etc. for all words in all 5 documents?
install.packages('tm')
library(tm)
setwd('C:\\Users\\900369\\Documents\\R\\Text Mining\\')
reviews1 <- read.csv("Evo-USA-Oct-Nov-141-160.csv",stringsAsFactors=FALSE)
reviews2 <- read.csv("Evo-USA-Oct-Nov-141-160 - Copy (2).csv",stringsAsFactors=FALSE)
reviews3 <- read.csv("Evo-USA-Oct-Nov-141-160 - Copy (3).csv",stringsAsFactors=FALSE)
reviews4 <- read.csv("Evo-USA-Oct-Nov-141-160 - Copy (4).csv",stringsAsFactors=FALSE)
reviews5 <- read.csv("Evo-USA-Oct-Nov-141-160 - Copy (5).csv",stringsAsFactors=FALSE)
filenames <- list.files('C:\\Users\\900369\\Documents\\R\\Text Mining\\',"*csv",FALSE,FALSE,FALSE,FALSE,FALSE)