[R] Training set in Self organizing Map

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Wed Jun 1 16:59:54 CEST 2016


You did not send  sample of your data, using dput. Before doing that,  I suggest peeling apart your troublesome line of code yourself:

str( as.matrix( scale( subdf ) ) )
str( scale( subdf ) )
str( subdf )

And then think about what the scale function does. Does it make sense to ask it to scale character or factor data? Could you perhaps exclude some of the columns that don't belong in the scaled data? 
-- 
Sent from my phone. Please excuse my brevity.

On June 1, 2016 7:39:30 AM PDT, "ch.elahe via R-help" <r-help at r-project.org> wrote:
>Hi all,
>I want to use Self Organizing Map in R for my data. I want my training
>set to be the following subset of my data:
> 
>
>    subdf=subset(df,Country%in%c("US","FR"))
>next I should change this subset to a matrix but I get the following
>error:
> 
>    data_train_matrix=as.matrix(scale(subdf))
>    error in colMeans(x,na.rm=TRUE):'x' must be numeric
> 
>Can anyone help me to solve that?
>Thanks for any help
>Elahe
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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]]



More information about the R-help mailing list