[R] Problem with lsa package (data.frame) on Windows XP

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Aug 19 17:45:20 CEST 2007


Please specify reproducible examples, it is almost impossible to help 
otherwise. Also, please provide all error messages and a traceback(). 
Please tell us versions of R and versions of the packages you are using.
If you are sure this is an error in the package, please send that 
reproducible example to the package maintainer.

Uwe Ligges


Walter Rojas wrote:
> Dear R team,
> 
> The following piece of code (to use the lsa package) works fine on my  
> mac os x, but when I run the same code on Windows XP, it doesn't work  
> any more.
> 
> ### code:
> library("lsa")
> matrix1 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 
> 000\\LSA\\cuentos\\", stemming=TRUE, language="spanish",  
> minWordLength=2, minDocFreq=1, stopwords=NULL, vocabulary=NULL)
> print(matrix1,bag_lines = 3, bag_cols = 3)
> matrix1 = lw_bintf(matrix1) * gw_idf(matrix1)
> space = lsa(matrix1, dims = dimcalc_share())
> as.textmatrix(space)
> 
> ### the following line fails on windows XP
> matrix2 = textmatrix("C:\\Documents and Settings\\tine stalmans.TINE. 
> 000\\LSA\\respuestas\\", stemming=TRUE, language="spanish",  
> minWordLength=2, minDocFreq=1, stopwords=NULL,vocabulary=rownames 
> (matrix1))
> matrix2 = lw_bintf(matrix2)
> matrix2fld = fold_in(matrix2, space)
> r <- cor(matrix2fld[,"respId1.txt"], matrix2fld[,"respAl1.txt"],  
> method = "pearson")
> print(r)
> 
> 
> An error occurs when creating the second textmatrix with the  
> vocabulary of the first. The error I get is:
> 
> in data.frame(docs = basename(file), terms = names(tab), Freq = tab,  :
>          arguments imply differing number of rows: 1, 0
> 
> When I change the vocabulary argument to NULL, it doesn't report this  
> error any more; however, then the code will fail on the fold_in  
> method further down.
> 
> I found another user who reported this same problem on-line; however,  
> I didn't find any answers.
> 
> Thank you very much in advance for your reply.
> Tine.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list