0

I'm trying to use the tm package in R to perform some text analysis. I received the following error:

I have changed directory manually

library(tm)
a<-Corpus(DirSource ("/st"), readerControl=list(language="english"))

Error in if (vectorized && (length <= 0)) stop("vectorized sources must have positive length") : missing value where TRUE/FALSE needed

I am unable to understand this error, please suggest where I am making my blunder.

Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138
  • 3
    Someone familiar with the topic will probably be able to tell you, but to those of us who are not familiar with text mining, you could throw a bone and provide us with a small reproducible example. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Roman Luštrik Aug 22 '12 at 11:35
  • I think the problem comes from `DirSource()`. You give it `"/st"` whereas you must put **A character vector of full path names** according to the manual (http://cran.r-project.org/web/packages/tm/tm.pdf). Besides, which OS do you work on ? – Pop Aug 22 '12 at 11:43

2 Answers2

1

You can try to specify the full path.

a <- Corpus (DirSource("C:/Users/USER/Downloads/ST"))
inspect(a)
user3117837
  • 87
  • 1
  • 8
0

The context is quite unclear in your question, so that I'm not sure to have fully understand what you want.

As you have said you have changed the directory manually, to use DirSource, you have to do :

DirSource("./st") if "st" is the directory in which you want to read your documents (or ".\st" if you use Windows). The . character must be used.

Pop
  • 12,135
  • 5
  • 55
  • 68