How to remove variables from an R formula -
i'm trying write next formula:
everything_time <- system.time(everything_rsf <- rfsrc( surv(time = pfs, event = censoring, type = c("right")) ~.-c(sample.id,patientid,uniqueid,pfs,censoring), info = data_endogenous)) as can see, remove whole bunch of variables. yet, when everything_rsf$importance, still have sample.id, patientid, uniqueid in model. i'm not sure why.
i've tried listing them out individually well.
thanks!
formula won't take list or vector arguments, string created.
data(iris) fmla <- as.formula(paste("species ~", paste(c(".","sepal.length","petal.width"), collapse = " - "))) glm(fmla, info = iris, family = binomial(link = "logit")) specific predictors can defined too.
data(iris) fmla <- as.formula(paste("species ~", paste(grep("width", names(iris), value = true), collapse = " + "))) glm(fmla, info = iris, family = binomial(link = "logit")) can combine these methods removing , adding predictors desired, while leaving dataset alone. can useful when making multiple models same dataset.
r
No comments:
Post a Comment