We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5748794 commit a68cf23Copy full SHA for a68cf23
R/misc.R
@@ -101,3 +101,20 @@ resolve_args <- function(args, ...) {
101
}
102
args
103
104
+
105
106
+# A function to convert a R formula to spark format
107
+surv_to_spark_formula <- function(f) {
108
+ if (!inherits(f, "formula"))
109
+ stop("A formula is required.")
110
+ if (length(f[[2]]) != 3)
111
+ stop("spark requires the `Surv` object to have a ",
112
+ "censoring indicator.")
113
+ if (!all.equal(f[[2]][[1]], as.name("Surv")))
114
+ stop("The formula sould contain a `Surv` object.")
115
+ f2 <- f
116
+ f2[[2]] <- f[[2]][[2]]
117
+ list(formula = f2, censor = deparse(f[[2]][[3]]))
118
+}
119
120
0 commit comments