adding parameter function in R

Viewed 25

I have a feature selection function that is selecting the features by Lasso or MRMR method, but the MRMR method has a tuning parameter (K) in which Lasso does not. I can't add this K as a parameter into the function (like function(data, method) ). How can I add this K as a parameter into the function i.e. function(data, method, K) how can i do like this?

feature_selection <- function(data, method = c("Lasso",  "MRMR"),... )
  if (method == "Lasso") {
    ...
  } else {
    K=3 OR K = 6
  ...
  }
return(X)
}
0 Answers
Related