Learn R Programming

cutpointr (version 1.1.2)

add_metric: Add metrics to a cutpointr or roc_cutpointr object

Description

By default, the output of cutpointr includes the optimized metric and several other metrics. This function adds further metrics. Suitable metric functions are all metric functions that are included in the package or that comply with those standards.

Usage

add_metric(object, metric)

# S3 method for cutpointr add_metric(object, metric)

# S3 method for multi_cutpointr add_metric(object, metric)

# S3 method for roc_cutpointr add_metric(object, metric)

Arguments

object

A cutpointr or roc_cutpointr object.

metric

(list) A list of metric functions to be added.

Value

A cutpointr or roc_cutpointr object (a data.frame) with one or more added columns.

See Also

Other main cutpointr functions: boot_ci(), boot_test(), cutpointr(), multi_cutpointr(), predict.cutpointr(), roc()

Examples

Run this code
# NOT RUN {
library(dplyr)
library(cutpointr)
cutpointr(suicide, dsi, suicide, gender) %>%
  add_metric(list(ppv, npv)) %>%
  select(optimal_cutpoint, subgroup, AUC, sum_sens_spec, ppv, npv)
# }

Run the code above in your browser using DataLab