[R] Problem with lsa package (data.frame) on Windows XP
Walter Rojas
walterrojas at mac.com
Sun Aug 19 00:31:48 CEST 2007
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.
More information about the R-help
mailing list