[R] nnet: cannot coerce class c("terms", "formula") into a data.frame

From: cobbler_squad <la.foma_at_gmail.com>
Date: Wed, 02 Jun 2010 11:15:00 -0700 (PDT)

Dearest all,

Objective: I am now learning neural networks. I want to see how well can train an artificial neural network model to discriminate between the two files I am attaching with this message.

http://r.789695.n4.nabble.com/file/n2240582/3dMaskDump.txt 3dMaskDump.txt http://r.789695.n4.nabble.com/file/n2240582/test_vowels.txt test_vowels.txt

Question: when I am attempting to run
>cvc_nnet <- nnet(G ~ ., data=cvc_lda, size=1,iter=10,MaxNWts=100)
I get an error saying:
Error in as.data.frame.default(x[[i]], optional = TRUE) :   cannot coerce class c("terms", "formula") into a data.frame

I have not encountered this error when I was running this script with previous lda results, and, I am not quite sure what the error means.

Below is short (and, I hope, reproducible) code.


cvc_nnet <- nnet(G ~ ., data=cvc_lda, size=1,iter=10,MaxNWts=100)

predict(cvc_nnet,cvc_lda,type = "class") table(predict(cvc_nnet,cvc_lda,type = "class"),cvc_lda$G)

all = c(1:52)

for(n in all){
  cvc_nnet <- nnet(G ~ ., data=cvc_lda[all != n,], CV =TRUE,size=1,iter=10,MaxNWts=100)
   cvc_nnet.out <- c(cvc_nnet.out,predict(cvc_nnet,cvc_lda[all == n,],type = "class"))



to get cvc_lda:


vowel_features <- data.frame(as.matrix(read.table(file = "test_vowels.txt")))
mask_features <- data.frame(as.matrix(read.table(file = "3dmaskdump.txt"))) G <-vowel_features[,41]

cvc_lda <- lda(G ~ ., data=mask_features, na.action="na.omit", CV=TRUE)

Your insight is very much appreciated it!

View this message in context: http://r.789695.n4.nabble.com/nnet-cannot-coerce-class-c-terms-formula-into-a-data-frame-tp2240582p2240582.html
Sent from the R help mailing list archive at Nabble.com.

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 02 Jun 2010 - 20:16:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 02 Jun 2010 - 23:20:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive