Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 错误:(列表)无法将对象强制为添加图例的“逻辑”类型_R_Legend - Fatal编程技术网

R 错误:(列表)无法将对象强制为添加图例的“逻辑”类型

R 错误:(列表)无法将对象强制为添加图例的“逻辑”类型,r,legend,R,Legend,我在R中遇到了一个传奇。我在处理生存数据,我有两条kaplan-meir曲线。我需要确定我的情节中的每一个。我正在使用legend,这是我尝试过的: plot(kmenfprimaria.dos.inicio, ylab="2B. Probabilidad de supervivencia", family="Times Roman", xlab="Tiempo en días", sub="Mediana: LLA 175 IC 95% (142-295); LMA:

我在R中遇到了一个传奇。我在处理生存数据,我有两条kaplan-meir曲线。我需要确定我的情节中的每一个。我正在使用legend,这是我尝试过的:

plot(kmenfprimaria.dos.inicio, ylab="2B. Probabilidad de supervivencia", 
     family="Times Roman", xlab="Tiempo en días", 
     sub="Mediana: LLA 175 IC 95% (142-295); LMA: 159 IC 95% (59-NR). p(log-rank)=0.783",
     ps=3, cex.main=0.9, cex.sub=0.7, cex.lab=0.7, 
     main="Supervivencia por diagnóstico", cex.main=0.9, lty=c(1,2), lwd=2, 
     legend(450, 0.8,legend= c("LLA","LMA"), lty=c(1,2), lwd=2))
错误:无法将列表对象强制为“逻辑”类型

我不知道该怎么强迫这个对象

图例不是绘图的参数,您需要先调用绘图,然后调用图例

plot(kmenfprimaria.dos.inicio, ylab="2B. Probabilidad de supervivencia", 
 family="Times Roman", xlab="Tiempo en días", 
 sub="Mediana: LLA 175 IC 95% (142-295); LMA: 159 IC 95% (59-NR). p(log-rank)=0.783",
 ps=3, cex.main=0.9, cex.sub=0.7, cex.lab=0.7, 
 main="Supervivencia por diagnóstico", cex.main=0.9, lty=c(1,2), lwd=2)

 legend(450, 0.8,legend= c("LLA","LMA"), lty=c(1,2), lwd=2)