在 R 中调用函数时,如何检索结果值。例如,我使用了 'roc' 函数,我需要提取 AUC 值和 CI(在以下示例中分别为 0.6693 和 0.6196-0.7191)。
> roc(tmpData[,lenCnames], fitted(model), ci=TRUE)
Call:
roc.default(response = tmpData[, lenCnames], predictor = fitted(model), ci = TRUE)
Data: fitted(model) in 127 controls (tmpData[, lenCnames] 0) < 3248 cases (tmpData[, lenCnames] 1).
Area under the curve: 0.6693
95% CI: 0.6196-0.7191 (DeLong)
我可以使用以下内容来获取这些带有关联文本的值。
> z$auc
Area under the curve: 0.6693
> z$ci
95% CI: 0.6196-0.7191 (DeLong)
有没有办法只获取值而不是文本。
我现在知道如何使用“正则表达式”或“strsplit”函数来获取这些值,但我怀疑应该有其他方法可以直接访问这些值。