[R] Problems with rJava and tm packages

PDXRugger J_R_36 at hotmail.com
Thu Oct 15 20:12:19 CEST 2009


I am looking to do some text analysis using R and have run into some issues
with some of the packages.  Im not sure if its my goofy Vista OS or what but
using R 2.8.1 i s relatively successful loading the text but the rJava
package was messed up somehow:

 library(tm)
> library(rJava)
Error in if (!nchar(javahome)) stop("JAVA_HOME is not set and could not be
determined from the registry") : 
  argument is of length zero
In addition: Warning message:
package 'rJava' was built under R version 2.9.1 
Error : .onLoad failed in 'loadNamespace' for 'rJava'
Error: package/namespace load failed for 'rJava'
> 
> #Set documents directory 
> DIR <- "G:/TextSearch/Speeches"
> 
> #Load corpus
> speech <- Corpus(DirSource(DIR), readerControl = list(reader = readPlain,
+ language = "en_US", load = TRUE))
> 
> #Remove stopwords
> speech <- tmMap(speech, stripWhitespace)
> speech 
A corpus with 2 text documents

> tdm<-TermDocumentMatrix(speech)
Error in if (!nchar(javahome)) stop("JAVA_HOME is not set and could not be
determined from the registry") : 
  argument is of length zero
Error: .onLoad failed in 'loadNamespace' for 'rJava'

--------------------------------------------------------
So the initial question is whats going on with the rJava package? I get the
same error when i try and load the package and then when i try and utilize a
function from the package. 

I tried installing 2.9.2 and ran into more problems when running the lines:

>utils:::menuInstallPkgs()
Warning: package 'tm' is in use and will not be installed
> speech <- tmMap(speech, stripWhitespace)
Error: could not find function "tmMap"

the package is installed correctly but its not able to pick  it up in this
version of R.  Again, im not sure if its somehting with Vista or what. 
Thanks guys and gals

Cheers,
JR
-- 
View this message in context: http://www.nabble.com/Problems-with-rJava-and-tm-packages-tp25913472p25913472.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list