[R] Y in Kohonen xyf function

chalabi.elahe at yahoo.de chalabi.elahe at yahoo.de
Wed Jun 22 21:00:55 CEST 2016


Dear Kimmo,
I already used df$speed[training] in df.xyf but I get this error:
   Error in xyf(Xtraining,factor(df$speed[training]),grid=somgrid(5, :
   NA/NaN/Inf in foreign function call (arg 1)





On Wednesday, June 22, 2016 3:48 AM, K. Elo <maillists at pp.inet.fi> wrote:
Hi again!

21.06.2016, 21:33, chalabi.elahe at yahoo.de wrote:
> Hi Kimmo, Thanks for your reply. I think now my problem is that I
> don't understand what does factor(df.classes[training]) do?

Sorry, my mistake, should habe been 'df$speed'. Please try the following:

--- snip ---

set.seed(7) training <- sample(nrow(df), 120)
Xtraining<- scale(df[training,])
Xtest <- scale(df[-training,], center = attr(Xtraining, 
"scaled:center"), scale = attr(Xtraining,
"scaled:scale"))
xyf.df <- xyf(Xtraining, factor(df$speed[training]), grid =

somgrid(5, 5, "hexagonal"))

--- snip ---

HTH,
Kimmo

______________________________________________
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.



More information about the R-help mailing list