I'm attempting to use removeWords in the R tm package using the following code:
docs <- tm_map(docs, removeWords, stopwords("english"))
and I get the following error message:
Error in sort (words, decreasing = TRUE) :
argument "words" is missing, with no default
All of the other transformations I've attempted on my corpus have worked as intended (tolower, removeNumbers, stripWhitespace, removePunctuation etc...) but I can not get removeWords to work properly, and can not find anything online about this particular error message.
I'd very much appreciate any insight into what might be causing this error.
Edit: My corpus consists of html documents all located in the same folder. The code I'm using to test the removeWords transformation is as follows:
setwd(“C:/folder”)
library(RCurl)
library(XML)
library (tm)
library (SnowballC)
docs <- Corpus(DirSource(“C:/folder”))
docs <- tm_map(docs, removePunctuation)
docs <- tm_map(docs, tolower)
docs <- tm_map(docs, removeNumbers)
docs <- tm_map(docs, removeWords, stopwords(“english”))