Hello useRs!

So, I have a random question.  I'm trying to build a character string, then
evaluate it.  I think an example would be the easiest way to explain:


    kern.vec = c("rbfdot","polydot")
    for( j in 1:length( kern.vec ) )
    {
      formula    = paste("ksvm( ind ~ . ,
data=d.temp[,c(ind_col,dep_cols)], kernel =",kern.vec[j],", prob.model=T )")
      svm    = eval( parse( text=formula ) )
     ...
    }


The problem I always seem to have is that in the formula, I need to have
quotes around "rbfdot" (for example).  But, when I paste the expression
together, it removes the quotes.  Is there a better way to do this (or at
least a way around this problem)?  My method seems a bit kludgy :)

Thanks for all your help!

Josh

        [[alternative HTML version deleted]]

______________________________________________
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