Thie1e / cutpointr

Optimal cutpoints in R: determining and validating optimal cutpoints in binary classification
https://cran.r-project.org/package=cutpointr
84 stars 13 forks source link

Auto-select numeric columns in multi_cutpointr #16

Closed xrobin closed 5 years ago

xrobin commented 5 years ago

If I run multi_cutpointr on the suicide dataset without specifying x, I get the following error on a non-numeric column:

multi_cutpointr(suicide, class = "suicide")
age:
Assuming the positive class is no
Assuming the positive class has higher x values
gender:
Error in median.default(x[class == uc[1]]) : need numeric data

It is common to have non-numeric columns with different groupings etc. that may not be used right now. Just like the gender column. It would be a nice addition to auto-detect numeric columns only.

Thie1e commented 5 years ago

Hi, thanks for the suggestion, I think that's a good idea and I've added that feature to the current version on Github, so multi_cutpointr(suicide, class = "suicide") should now run without any problems.

If the new default of x = NULL is kept, an internal function is called that fetches the names of all numeric columns.

xrobin commented 5 years ago

Works great!

Thie1e commented 5 years ago

Glad to hear that!