You need to read the Help page for the function survSplit ?survSplit states that the id argument is a
"character string with the name of new id variable to create (optional). This can be useful if the data set does not already contain an identifier" The addicts data.frame has as its first column 'id', which seems to be the cause of the ERROR message. HTH, Eric On Wed, Oct 31, 2018 at 5:37 PM Medic via R-help <r-help@r-project.org> wrote: > > When I run the code from the book Kleinbaum "Survival analysis" (7. > Running an extended cox model. Page 646) I got an ERROR. What do you think > is the reason? I attach a file with few lines of dataset "addicts-dput.r". > > library(cmprsk) > > addicts = read.csv ("addicts.csv") > id clinic status survt prison dose > 1 1 1 1 428 0 50 > 2 2 1 1 275 1 55 > 3 3 1 1 262 0 55 > 4 4 1 1 183 0 30 > 5 5 1 1 259 1 65 > 6 6 1 1 714 0 55 > 7 7 1 1 438 1 65 > 8 8 1 0 796 1 60 > 9 9 1 1 892 0 50 > > addicts.cp=survSplit(addicts, cut=addicts$survt[addicts$status==1], > end="survt", event="status",start="start", id="id") > ERROR in survSplit(addicts, cut = addicts$survt[addicts$status == 1],: the > suggested id name is already present. > > > > ______________________________________________ > R-help@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. > [[alternative HTML version deleted]] ______________________________________________ R-help@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.