Skip to content

make attempts to stratify on a Surv object error better #230

@hfrick

Description

@hfrick

it'd be good to have a simple error message explaining that you can't stratify on a Surv object rather than have the error from survival bubble up.

library(rsample)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(survival)
data("lung")

lung %>% 
  mutate(surv = Surv(time, status)) %>% 
  initial_split(strata = "surv")
#> Error in Ops.Surv(x[hi], qs): Invalid operation on a survival time

Created on 2021-03-16 by the reprex package (v1.0.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions