'sivs R package Error in apply(coef.df, 1, function(f) { : dim(X) must have a positive length

In the documentation of sivs the example looks like this:

***sivs_obj <- sivs(x = tmp[, c("Sepal.Length", "Sepal.Width",
                             "Petal.Length", "Petal.Width")],
                 y = factor(tmp$Species),
                 family = "binomial",
                 verbose = "detailed",
                 progressbar = FALSE,
                 nfolds = 3,
                 parallel.cores = FALSE,
                 iter.count = 20)***

I've followed it like this:

***sivs_obj <- sivs(x=sx, y=factor(xql.eff$effect_mu), family = "binomial")***

and it gives me this error:

***Error in apply(coef.df, 1, function(f) { : 
  dim(X) must have a positive length***

which I looked up, and I found that the problem is that the apply gets a vector instead of matrix or dataframe. I guess that vector is the y. But the documentation example uses vector aswell (at least I think). What can I do? Or could somebody tell me what is the real problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source