title: SVM Feature Selection using SCAD
body: <p>Using <code>penalizedSVM</code> R package, I am trying to do feature selection. There is a list of several data.frames called trainingdata.</p>
  
  <pre><code>trainingdata &lt;-lapply(trainingdata, function(data)
                     {
                       levels(data$label) &lt;- c(-1, 1)
                       train_x&lt;-data[, -1]
                       train_x&lt;-data.matrix(train_x)
                       trainy&lt;-data[, 1]
                       print(which(!is.finite(train_x)))
                       scad.fix&lt;-svm.fs(train_x, y=trainy, fs.method="scad",
                                        cross.outer=0, grid.search="discrete",
                                        lambda1.set=lambda1.scad, parms.coding="none",
                                        show="none", maxIter=1000, inner.val.method="cv",
                                        cross.inner=5, seed=seed, verbose=FALSE)
  
                       data &lt;- data[c(1, scad.fix$model$xind)]
                       data
                     })
  </code></pre>
  
  <p>Some iterations go well but then on one data.frame I am getting the following error message.</p>
  
  <pre><code>[1] "feature selection method is scad"
  Error in svd(m, nv = 0, nu = 0) : infinite or missing values in 'x'
  Calls: lapply ... scadsvc -&gt; .calc.mult.inv_Q_mat2 -&gt; rank.condition -&gt; svd
  </code></pre>
  
  <p>Using the following call, I am also checking whether x is really infinite but the call returns 0 for all preceding and the current data.frame where the error has occurred.</p>
  
  <pre><code>print(which(!is.finite(train_x)))
  </code></pre>
  
  <p>Is there any other way to check for infinite values? What else could be done to rectify this error? Is there any way that one can determine the index of the current data.frame being processed within lapply?</p>