R/fit_and_eval_spline_model.R

Defines functions fit_and_eval_spline_model

fit_and_eval_spline_model <- function(df, xNew, modelFormula){
  splineFit <- try(rlm(as.formula(modelFormula), 
                       data = df, maxit = 150),
                   silent = TRUE)
  if (!inherits(splineFit, "try-error")){
    yNew <- predict(splineFit, list(x = xNew))
  } else {
    yNew <- NA
  }
  normDF <- data.frame(x = xNew, splinePrediction = yNew)
  return(normDF)
}
Bioconductor-mirror/TPP documentation built on July 7, 2017, 11:01 p.m.