R/OmicSelector_create_formula.R

Defines functions OmicSelector_create_formula

Documented in OmicSelector_create_formula

#' OmicSelector_create_formula
#'
#' Helper function to create formula based on selected miRNAs.
#'
#' @param selected_features Selected miRNAs as characted vector.
#' @return Formula "Class ~ ..." to be used in another functions.
#'
#' @export
OmicSelector_create_formula = function(selected_features) {
  if(selected_features[1] == "." || length(selected_features) ==0 ) { stop("Too few features selected.") }
  selected_features<-selected_features[!is.na(selected_features)]
  as.formula(paste0("Class ~ ",paste0(as.character(selected_features), collapse = " + ")))
}
kstawiski/OmicSelector documentation built on April 10, 2024, 11:11 p.m.