[英]Is there a way to manually change label colors in nomogram drawn with the rms-package?
[英]nomogram() of rms not working in a function
我正在尝试使以下功能正常工作,但出现错误:
> mynomogram
function(sfstr, mydf){
sf = as.formula(sfstr)
library(rms)
mod = ols(sf, mydf)
dd = datadist(mydf)
options(datadist='dd')
plot(nomogram(mod))
}
>
> mynomogram('mpg~disp+hp+cyl', mtcars)
Error in value.chk(at, i, NA, -nint, Limval, type.range = "full") :
variable disp does not have limits defined by datadist
>
> mynomogram('mpg~disp+hp+cyl', mtcars)
Error in Design(X) : dataset dd not found for options(datadist=)
错误在哪里,如何解决? 谢谢你的帮助。
使用 dd <<- datadist(mydf)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.