Ordered treated as numbers
> text.levels <- aSAH$wfns
> head(text.levels)
[1] 1 1 1 1 3 2
Levels: 1 < 2 < 3 < 4 < 5
> levels(text.levels)
[1] "1" "2" "3" "4" "5"
> levels(text.levels) <- c("very low", "low", "medium", "high", "very high")
> head(text.levels)
[1] very low very low very low very low medium low
Levels: very low < low < medium < high < very high
> r <- roc(aSAH$outcome, text.levels)
> r$thresholds
[1] -Inf 1.5 2.5 3.5 4.5 Inf
Only makes sense if ordered values are actually 1, 2, ... n
Steps to reproduce:
text.levels <- aSAH$wfns
levels(text.levels) <- c("very low", "low", "medium", "high", "very high")
r <- roc(aSAH$outcome, text.levels)
r$thresholds
Allowing textual thresholds seems to break a lot of assumptions. Initial work in separate ordered_fix branch breaks horribly many tests. Coordinates are converted to text (with transpose=TRUE). It might be better to just warn the user.
Previous commit is a workaround to convert through a character vector if possible (keeping numeric values if the ordered values are numbers). There is now a warning in case of a conversion to integer values.
The 1.16 release will have the previous workaround to use the correct numbers (if actually numbers) or warn the user.
Once we return a data.frame by default, and transpose becomes deprecated, it will be possible to return character thresholds in coords, and revisit this issue. Until then it will be on hold.