Transposing the output of coords

This help page desribes recent and upcoming changes in the return values of the coords function.

Background information

Untile the release of pROC 1.16, the coords has was returning a matrix with thresholds in columns, and the coordinate variables in rows.

rocobj <- roc(aSAH$outcome, aSAH$s100b)
coords(rocobj, c(0.05, 0.2, 0.5))
#                   0.05       0.2       0.5
# threshold   0.05000000 0.2000000 0.5000000
# specificity 0.06944444 0.8055556 0.9722222
# sensitivity 0.97560976 0.6341463 0.2926829

This format didn't conform to the grammar of the tidyverse which has become prevalent in modern R language.

In addition, the dropping of dimensions by default makes it difficult to guess what type of data coords is going to return.

coords(rocobj, "best")
#   threshold specificity sensitivity 
#   0.2050000   0.8055556   0.6341463 
# A numeric vector

Although it is possible to pass drop = FALSE, the fact that it is not the default makes the behaviour unintuitive.

In pROC version 1.16, this was changed and coords now returns a data.frame with the thresholds in rows and measurement in colums by default.

 coords(rocobj, c(0.05, 0.2, 0.5), transpose = FALSE)
#      threshold specificity sensitivity
# 0.05      0.05  0.06944444   0.9756098
# 0.2       0.20  0.80555556   0.6341463
# 0.5       0.50  0.97222222   0.2926829

Changes in 1.15

  1. Addition of the transpose argument.

  2. Display a warning if transpose is missing. Pass transpose explicitly to silence the warning.

  3. Deprecation of as.list.

Changes in 1.16

  1. Change of the default transpose to TRUE.


Upcoming changes in future versions

It is expected that the following major version (1.17) will remove the warning and drop support for the as.list argument altogether.

The transpose and drop arguments will be deprecated in 1.17, but will remain available for a few additional major versions.

Related changes in ci.coords

In version 1.16, the format of the ci.coords return value was changed from a matrix-like object with mixed x and ret in rows and 3 columns, into a list-like object which should be easier to use programatically.


If you are writing a new script calling the coords function, set transpose = FALSE to silence the warning and benefit from the latest improvements in pROC and obtain a tidy data.

See Also

The GitHub issue tracking the changes described in this manual page.

  • coords_transpose
Documentation reproduced from package pROC, version 1.16.2, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.