简体   繁体   English

在R包中包含“生存”功能

[英]Including function from “survival” in R package

I would like to include in my R package a new function, which requires the Surv function from the survival package. 我想在我的R包中包括一个新函数,该函数需要Survival包中的Surv函数。 I did include import(survival) in the NAMESPACE and I have survival installed; 我确实在名称空间中包含了导入(生存)功能,并且安装了生存功能; however, when I run R CMD check, I still get this error message: 但是,当我运行R CMD检查时,仍然收到此错误消息:

Error in Surv(time, status) : could not find function "Surv" Surv(时间,状态)错误:找不到函数“ Surv”

I do have dependencies from other packages and I never faced such an issue. 我确实有来自其他软件包的依赖关系,但我从未遇到过这样的问题。 I already tried with no success to implement the solutions recommended here: 我已经尝试过成功实施此处推荐的解决方案:

http://r.789695.n4.nabble.com/requireNamespace-etiquette-td4703620.html http://r.789695.n4.nabble.com/requireNamespace-etiquette-td4703620.html

Any suggestions on what might be the problem? 关于可能是什么问题的任何建议?

You have to do the following 您必须执行以下操作

  1. install.packages("survival")
  2. library("survival")

and then the surv() function will work 然后surv()函数将起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM