Thanks for bringing this issue in the book's description of survSplit() to my attention. It seems the change to the behavior of survSplit() was introduced in survival version 2.39-2. Up to (including) version 2.38-3, no formula was required if arguments 'end' and 'event' were specified. A corrected pdf of the chapter is available at http://dwoll.de/r/gddmr/09_survival.pdf Daniel Wollschlaeger
On August 19, 2016 4:21:31 AM PDT, "Vinzenz V?lkel via R-help" <r-help at r-project.org> wrote:
Dear R-help-community, I hope, that?s the appropiate channel to post a quastion? For some days I have been struggling with a problem concerning the ?survSplit?-function of the package ?survival?. Searching the internet I have found a pretty good -German- description of Daniel Wollschl?ger describing how to use survSplit: (https://books.google.de/books?id=9G4oBgAAQBAJ <https://books.google.de/books?id=9G4oBgAAQBAJ&pg=PA345&lpg=PA345&dq=daniel+ wollschl%C3%A4ger+survsplit&source=bl&ots=ajPgInB83d&sig=noQIAXMWe6oQJ-LwsTC kroWdwHQ&hl=de&sa=X&ved=0ahUKEwiqwoX8q83OAhVlM5oKHSMGDrEQ6AEIHjAA#v=onepage& q=daniel%20wollschl%C3%A4ger%20survsplit&f=false> &pg=PA345&lpg=PA345&dq=daniel+wollschl%C3%A4ger+survsplit&source=bl&ots=ajPg InB83d&sig=noQIAXMWe6oQJ-LwsTCkroWdwHQ&hl=de&sa=X&ved=0ahUKEwiqwoX8q83OAhVlM 5oKHSMGDrEQ6AEIHjAA#v=onepage&q=daniel%20wollschl%C3%A4ger%20survsplit&f=fal se Mr. Wollschl?ger also provides the dataset, all of the code he used and an excerpt of his output:
library(survival) # f?r survSplit()
dfSurvCP <- survSplit(dfSurv, cut=seq(30, 90, by=30), end="obsT",
+ event="status", start="start", id="ID", zero=0) # sortiere nach Beobachtungsobjekt und linken Intervallgrenzen
idxOrd <- order(dfSurvCP$ID, dfSurvCP$start)
head(dfSurvCP[idxOrd, ], n=7)
obsT status sex X IV start ID 1 30 0 f -1.3130607 A 0 1 181 60 0 f -1.3130607 A 30 1 361 63 1 f -1.3130607 A 60 1 10 11 1 f -1.2282824 A 0 10 100 27 1 m -0.1018403 B 0 100 101 30 0 m -0.4079027 B 0 101 281 42 1 m -0.4079027 B 30 101 Unfortunaltely when I tried to copy Mr. Wollschl?gers operations using his very dataset, RStudio just returned the following error-message:
dfSurvCP2 <-
survSplit(dfSurv,cut=seq(30,90,by=30),end="obsT",event="status",start="start ",id="ID",zero=0) Error in formula.default(eval(parse(text = x, keep.source = FALSE)[[1L]])) : invalid formula I tried to figure out what?s wrong, but so far didn?t find any solutions? I would be very glad if anyone could help me out here. vhfv [[alternative HTML version deleted]] ------------------------------------------------------------------------
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.