Sophia J
Sophia J

Reputation: 105

Can't find the function after require(thePackage)

I am trying to get the plot.cuminc() function in the cmprsk package.

I installed the package and used require(cmprsk) as well as library(cmprsk) but R still can't find the function.

p.s. I used ?plot.cuminc() and find the help document

Dose anyone know what's wrong with the R , or my code?

Upvotes: 0

Views: 485

Answers (1)

nograpes
nograpes

Reputation: 18323

If you run plot on a cuminc object, it will automatically run plot.cuminc. Try running this example code:

set.seed(2)
ss <- rexp(100)
gg <- factor(sample(1:3,100,replace=TRUE),1:3,c('a','b','c'))
cc <- sample(0:2,100,replace=TRUE)
strt <- sample(1:2,100,replace=TRUE)
print(xx <- cuminc(ss,cc,gg,strt))
plot(xx,lty=1,color=1:6)

If you really want to look at the function, or run it directly for some reason, you can use cmprsk:::plot.cuminc.

Upvotes: 3

Related Questions