[R] kohonen: "Argument data should be numeric"

Jay josip.2000 at gmail.com
Fri Feb 25 15:33:41 CET 2011


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.



Thanks,
Jay



More information about the R-help mailing list