OK. I will try to explain in the best way: Starting point: I had an arc list (like list provided by social network softwares: Pajek, Ucinet...) With this form:
ID1 IDP2 SUMVAL 1 2 0.065 1 3 0.044 3 1 0.071 3 4 0.016 3 5 0.011 4 3 0.004 4 7 0.004 4 9 0.004 ... I transformed this list (recorded in a CSV file) into "matrix" using this code: > nbrs <- > read.table("C:/Users/AJ/Desktop/paper3/prueba3/pajek/mix_dc_cc_cp_jidpajek.csv", > header=T, quote="\"") > mymatrix <- xtabs(SUM_NORM_DC_CC_CP ~ IDP1 + IDP2, data=nbrs) > write.table(mymatrix, file = "C:/backup/matriz_v3.csv"), row.names= FALSE, > col.names= FALSE) Now my intention is to calculate cosine similarities on data of this "matrix" (14179 rows x 10317 columns). In order to do this I have tried: > library(lsa) > matrix_v3 <- > read.table("C:/Users/AJ/Desktop/paper3/matriz_lista_10/matrix_v3.csv", sep= " > ", header= F) > as.matrix <- matrix_v3 > cosine(matrix_v3, y = NULL) And R returns me this message: Error en cosine(matrix_v3) : argument mismatch. Either one matrix or two vectors needed as input. After that, I tried to convert "matrix_v3" using > cosine(matrix_v3, y = NULL) but it was not possible. That's all. I hope this is enough. Thanks and sorry for inconvenience. AJ > Date: Thu, 23 Feb 2012 13:15:16 +0100 > From: lig...@statistik.tu-dortmund.de > To: anxu...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] Problems with Cosine Similarity using library(lsa) > > > > On 23.02.2012 13:07, A J wrote: > > > > Thanks Uwe, you vere right. Now the library is working but I have next > > problem as well. > > > > I have loaded a matrix (named matrix_v3) from a TXT file. This matrix was > > previously reached using xtabs function. Now I have used this formula to > > obtain cosine similarities from my data matrix (following instructions of > > lsa package instructions): > > > >> cosine(matrix_v3, y = NULL) > > > > Finally R returns this message: > > > > Error en cosine(matrix_v3, y = NULL) : argument mismatch. Either one > > matrix or two vectors needed as input. > > > > I understand that R don't contemplate matrix_v3 like a real matrix. If this > > is like this, how can I do? I have tried "as.matrix" but it does not work. > > Sorry if my questions are not very fine, but I am newbie in using R. > > > We do not know what you object matrix_v3 is, so how could we help? > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > > Thanks again. > > > > > >> Date: Thu, 23 Feb 2012 11:35:04 +0100 > >> From: lig...@statistik.tu-dortmund.de > >> To: anxu...@hotmail.com > >> CC: r-help@r-project.org > >> Subject: Re: [R] Problems with Cosine Similarity using library(lsa) > >> > >> The error message suggests that you do not have Java installed. And > >> since you said it works in 32-bit: You only have a 32-bit Java but no > >> 64-bit Java installed in your machine. > >> > >> Uwe Ligges > >> > >> > >> On 23.02.2012 11:08, A J wrote: > >>> > >>> Hi everybody! > >>> > >>> I have intended to use library(lsa) on R 64-bits for Windows but it was > >>> not possible. Every time I try to launch library(lsa) function R give me > >>> back next message: > >>> > >>> Loading required package: SnowballError : .onLoad failed in > >>> loadNamespace() for 'Snowball', details: call: NULL error: .onLoad > >>> failed in loadNamespace() for 'rJava', details: call: stop("No > >>> CurrentVersion entry in '", key, "'! Try re-installing Java and make sure > >>> R and Java have matching architectures.") error: objeto 'key' no > >>> encontradoError: package Snowball could not be loaded > >>> > >>> Of course, I have loaded all necessary packages, but the only way to > >>> library(lsa) works it is on R 32-bits release. The problem here is that R > >>> don't leave me to load all data from my matrix and tell me that it is not > >>> able to load big vectors (may be due to limitations on memory of 32-bit > >>> release). > >>> > >>> The issue is that I need to calculate cosine similarities on my matrix > >>> data. Has somebody any suggestion or idea about how to do it (a different > >>> library or a formula to get it)? > >>> > >>> Thanks in advance. > >>> > >>> Best, > >>> > >>> AJ > >>> [[alternative HTML version deleted]] > >>> > >>> > >>> > >>> > >>> ______________________________________________ > >>> R-help@r-project.org 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. > > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.