Simple example for finding cutoff points not working

I'm trying to find optimal cutoff points using cutpointr

In the vignette they use a suicide (YES, NO) variable that indicates if the person had previous suicide attempts.

The function requires that variable, but I don't have it, so I included a variable Live with no values:

my data

dat <- read_xlsx("C:/findcutoff/mydata.xlsx")
dat$Live <- as.factor(dat$Live)
cp <- cutpointr(dat, Test, Live, method = maximize_metric, metric = sum_sens_spec)

But this is not working

Error in cutpointr_internal(x, class, subgroup, method, metric, pos_class,  : 
  NAs found but na.rm = FALSE

So I added "YES" and "NO" values to the Live variable

and this time it worked, I got a cutoff = 42

But if I change the "YES" and "NO" values to others, then I get other cutoff, so this means that the cutpointr function depends on the Live variable which I have invented..

Please can anybody clarify this? I'm totally confused..

Why is any of this surprising?
What would be the rationale of a function that took your parameters only to ignored them?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.