Skip to content

create_gains_curve() doesn't work for prevalence = 0.14 #136

@uriahf

Description

@uriahf
library(rtichoke)
create_gains_curve(
  probs = list(example_dat$estimated_probabilities),
  reals = list(c(rep(1, 21), rep(0, 129)))
)
#> Error in data.frame(reference_group = reference_group, x = reference_line_x_values, : arguments imply differing number of rows: 202, 203

The main problem is how length.out argument interprets 100*0.14:


length(seq(0, 1, length.out = 14))
#> [1] 14
length(seq(0, 1, length.out = 100*0.14))
#> [1] 15

Solution: wrap with as.integer()

length(seq(0, 1, length.out = as.integer(100*0.14)))
#> [1] 14

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions