Message-ID: <841170186.13161342.1466622055827.JavaMail.yahoo@mail.yahoo.com>
Date: 2016-06-22T19:00:55Z
From: Elahe chalabi
Subject: Y in Kohonen xyf function
In-Reply-To: <b9a527c6-0ed2-c968-5a4a-c2b13012a9ff@pp.inet.fi>
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.