I've written a method that takes a formula as an argument that then gets passed to stpm2. If my method's parameter is not named "formula" then I get an error. See below example:
sesssionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] splines stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstpm2_1.4.4 survival_2.42-3
loaded via a namespace (and not attached):
[1] compiler_3.5.1 Matrix_1.2-14 tools_3.5.1 mgcv_1.8-24 yaml_2.2.0 Rcpp_1.0.0 bbmle_1.0.20
[8] nlme_3.1-137 grid_3.5.1 numDeriv_2016.8-1 stats4_3.5.1 lattice_0.20-35
Reproducible example:
library(rstpm2)
data(brcancer)
# Function with model_formula paramter **ERRORS**
f_bad <- function(model_formula) {
stpm2(formula = model_formula, df = 2, data=brcancer, link.type = "PH")
}
# Function with formula paramter to match the name pf stpm2's formula parameter **PASSES**
f_good <- function(formula) {
stpm2(formula = formula, df = 2, data=brcancer, link.type = "PH")
}
f_bad (model_formula = Surv(rectime,censrec==1)~hormon)
f_good (formula = Surv(rectime,censrec==1)~hormon)
I've written a method that takes a formula as an argument that then gets passed to stpm2. If my method's parameter is not named "formula" then I get an error. See below example:
sesssionInfo()
Reproducible example: