Skip to content
Prev 293681 / 398502 Next

Pasting with Quotes

On May 5, 2012, at 2:42 PM, Josh Browning wrote:

            
Actually you are trying to build a language object , a call or an  
expression. You might have gotten further with:

do.call(ksvm, list(  ... named arguments ...)
Perhaps looking at either:

?substitute
?bquote

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

expression(ksvm(ind ~ ., data = d.temp[, c(ind_col, dep_cols)],
     kernel = "rbfdot", prob.model = T))
expression(ksvm(ind ~ ., data = d.temp[, c(ind_col, dep_cols)],
     kernel = "polydot", prob.model = T))

Notice that the values for kern.vec are 'character' which is what you  
passed them (and what you seem to be requesting. If you wanted the  
values of those named objects you might try get(<name>). (I'm not a  
user of whatever package has `ksvm` in it, so I'm not aware of whether  
'rbfdot' is supposed to be a character value as a parameter or if  
those are named objects, and I'm not running out to identify the  
package and then to locate a working example to test the eval-result.  
Those are details you should have provided.)