stc04003 / reReg

Regression methods for recurrent event data
https://www.sychiou.com/reReg/index.html
21 stars 5 forks source link

[Error] no slot of name "time_class" for this object of class "Recur" #26

Closed Generalized closed 2 years ago

Generalized commented 2 years ago

Hello,

I'm trying to follow the package vignette and it fails:

> library(reReg)
> data(readmission, package = "frailtypack")
> readmission <- subset(readmission, !(id %in% c(60, 109, 280)))
> reObj <- with(readmission, Recur(t.stop, id, event, death))
> plot(reObj)
Error in "Date" %in% formula@time_class : 
  no slot of name "time_class" for this object of class "Recur"

same about plotting the events:

> reReg::plotEvents(with(readmission, Recur(t.stop, id, event, death)))
Error in "Date" %in% formula@time_class : 
  no slot of name "time_class" for this object of class "Recur"

Plotting the MCF works, though:

plot(reObj, mcf = TRUE, mcf.conf.int = TRUE)

obraz

The MCF works:

> head(mcf(with(readmission, Recur(t.stop, id, event, death))~1)@MCF)
  time numRisk    instRate         MCF          se         lower       upper
1    1     400 0.000000000 0.000000000 0.000000000  0.0000000000 0.000000000
2    2     399 0.002506266 0.002506266 0.002503123 -0.0023997653 0.007412297
3    4     399 0.002506266 0.005012531 0.003535501 -0.0019169224 0.011941985
4    5     399 0.002506266 0.007518797 0.004324629 -0.0009573205 0.015994914
5    6     399 0.002506266 0.010025063 0.004987343  0.0002500508 0.019800074
6    7     399 0.002506266 0.012531328 0.005568956  0.0016163756 0.023446281
packageVersion("reReg")
[1] ‘1.4.4’

>version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          6.3                         
year           2020                        
month          02                          
day            29                          
svn rev        77875                       
language       R                           
version.string R version 3.6.3 (2020-02-29)
nickname       Holding the Windsock
stc04003 commented 2 years ago

Thank you for your comments. The described codes seem to work on my end. The error message you attached seems to be from the reda package. Are you using the latest reda? I tried your codes on reReg package version 1.4.5 (the current version I have on GitHub) and reda package version 0.5.4. You can install the latest version of reReg and reda by remotes::install_github("stc04003/reReg") and remotes::install_github("wenjie2wang/reda"), respectively. By the way, it might be a good idea to update R to a more recent version too. Please let me know how it turns out. Thanks!

Generalized commented 2 years ago

Thank you very much for a quick response! Unfortunately, I cannot update update R core. In the pharmaceutical industry, where I work, the environments are under strict control and can be frozen for years. Updating the core would change a number of things and specific packages I cannot update for backward compatibility yet. In general - it would break the validation certification.

I could install reda from GitHub (now it's 0.5.4), but the build of reReg failed - it requires R 4.2.0+ which I cannot afford. Currently I have 1.4.4. Luckily, rebuilding reda helped. You were right!

Thank you for directing me and I will close the issue now. It's all fine!

obraz