On 25.02.2011 15:33, Jay wrote:
Hi, I'm trying to utilize the kohonen package to build SOM's. However, trying this on my data I get the error: "Argument data should be numeric" when running the som(data.train, grid = somgrid(6, 6, "hexagonal")) function. As you see, there is a problem with the data type of data.train which is a list. When I try to convert it to "numeric" I get the error: (list) object cannot be coerced to type 'double' What should I do? I can convert the data.train if I take only one column of the list: data.train[[1]], but that is naturally not what I want. How did I end up with this data format? What I did: data1<- read.csv("data1.txt", sep = ";") training<- sample(nrow(data1), 1000) data.train<- data1[training,2:20] I tried to use scan as the import method (read about this somewhere) and unlist, but I'm not really sure how I should get it to numeric/ working.
We do not know what data types are present in data1. If all columns are numeric, just convert to a matrix (using as.matrix()).
Uwe Ligges
Thanks, Jay ______________________________________________ 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.
______________________________________________ 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.