[R] Factor levels in training set
chalabi.elahe at yahoo.de
chalabi.elahe at yahoo.de
Tue Jun 14 17:28:37 CEST 2016
Hi all,
I want to use Supervised Self organizing Maps from Kohonen package for my data. I need to divide my df into training set and test set, but a part of my df contains column with factor levels and I don't know how to bring them into my training set. Currently I use the following command for my training set:
dt=sort(sample(nrow(df),nrow(df)*.7))
training=m[dt,]
till here I get no error but in the next step which I need to bring my training set in a matrix I face this error:
scale(df[training,])
error: 'x' should be numeric
Does anyone know how should I include column with factor levels in my df so that I don't get this error?
Thanks for any help,
Elahe
More information about the R-help
mailing list