Error in findrow(fit, times, extend) : no points selected for one or more curves, consider using the extend argument

目录

Error in findrow(fit, times, extend) : no points selected for one or more curves, consider using the extend argument

问题:

解决:

完整错误:


ggDCA是目前能同时绘制Cox回归模型、logistic回归模型及广义线性模型的DCA曲线且其图形能用ggplot2美化

问题:

ggDCA包绘制DCA曲线发生如下错误:

Error in findrow(fit, times, extend) : no points selected for one or more curves, consider using the extend argument

library(rms)
library(ggDCA)

# one model
model1 <- lrm(status~age,lung)
dt=dca(model1)
ggplot(dt)

# 2 or more model
model1 <- lrm(status~age,lung)
model2 <- lrm(status~age+sex,lung)
dt=dca(model1,model2)
ggplot(dt)


解决:

解决方案1:

install.packages("devtools")
options(unzip ='internal')
devtools::install_github('yikeshu0611/ggDCA')

解决方案2:

1,卸载CRAN安装的ggDCA
2,remotes::install_github('yikeshu0611/ggDCA')
3,cox模型拟合用rms::cph而不是survival::coxph构建

#继续
 

library(rms)
library(ggDCA)

# one model
model1 <- lrm(status~age,lung)
dt=dca(model1)
ggplot(dt)

# 2 or more model
model1 <- lrm(status~age,lung)
model2 <- lrm(status~age+sex,lung)
dt=dca(model1,model2)
ggplot(dt)


完整错误:

 

Error in findrow(fit, times, extend) : no points selected for one or more curves, consider using the extend argument

ggplot2包是一种十分强大的数据可视化工具。基于Leland Wilkinson在《Grammar of Graphics》一书中提出的"图形语法"的概念,爱荷华州立大学的Hadley Wickham将这一想实现并法编写成了ggplot包。就像是使用主语、谓语、宾语来造句一样,ggplot包让你可以按照自己的想法使用图形语法将不同的元素组合来创造独一无二的图形。ggplot包目前的新版本就叫做ggplot2,作者Hadley Wickham在《ggplot2:数据分析与图形艺术》一书中说ggplot2"缩短了所思与所见的距离"。

ggplot2基于Leland Wilkinson在Grammar of Graphics(图形的语法)中提出的理论,取首字母缩写再加上plot,于是得名ggplot。按照《图形的语法》一书中的观点,一张统计图形就是从数据到点、线或方块等几何对象的颜色、形状或大小等图形属性的一个映射,其中还可能包含对数据进行统计变换(如求均值或方差),最后将这个映射绘制在一定的坐标系中就得到了我们需要的图形。图中可能还有分面,就是生成关于数据的不同子集的图形。使用ggplot2绘图的过程就是选择合适的几何对象、图形属性和统计变换来充分暴露数据中所含有的信息的过程。ggplot2需要一定的时间去入门学习,但是当你掌握了ggplot2中图形的语法的时候,我相信你会感受到这套语法的优雅。

"一张统计图形就是从数据到几何对象(geometric object, 缩写为geom, 包括点、线、条形等)的图形属性(aesthetic attributes, 缩写为aes, 包括颜色、形状、大小等)的一个映射。此外, 图形中还可能包含数据的统计变换(statistical transformation, 缩写为stats), 最后绘制在某个特定的坐标系(coordinate system, 缩写为coord)中, 而分面(facet, 指将绘图窗口划分为若干个子窗口)则可以用来生成数据中不同子集的图形。"

ggplot2 is an open-source data visualization package for the statistical programming language R. Created by Hadley Wickham in 2005, ggplot2 is an implementation of Leland Wilkinson's Grammar of Graphics—a general scheme for data visualization which breaks up graphs into semantic components such as scales and layers. ggplot2 can serve as a replacement for the base graphics in R and contains a number of defaults for web and print display of common scales. Since 2005, ggplot2 has grown in use to become one of the most popular R packages.

参考:https://rdrr.io/github/yikeshu0611/ggDCA/man/ggplot.ggdca.html
参考:https://zhuanlan.zhihu/p/498514177
参考:https://github/yikeshu0611/ggDCA
参考:https://github/yikeshu0611/ggDCA/issues/2

更多推荐

Error in findrow(fit, times, extend) : no points selected for one or more curves