On Oct 12, 2008, at 2:26 AM, Prof Brian Ripley wrote:

You need to use substitute() on the call.  Something like

sapply(1:5,function(i)
eval(substitute(svm(person_oid ~ ., data=zrr[1:N,]), list(N=100*i))
      )

Thanks!

On Sun, 12 Oct 2008, Alexy Khrabrov wrote:

I want to train svm models on increasingly large training data subsets of some zrr as follows:

m <- sapply(1:5,function(i) svm(person_oid~.,data=zrr[1:100*i,])) # (*)

However, when I inspect m[1], it literally shows

m[1]
[[1]]
svm(formula = person_oid ~ ., data = zrr[1:N, ])

I suspect it shows '100*i' not 'N', but in the absence of a reproducible example, I cannot check.

Exactly -- I've mixed in an attempt to define N in sapply(..., function(i) { N <- 100*i, ...}), but now see I need to do it in substitute().

Cheers,
Alexy

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to