Hello,
I'm trying to obtain a Swimmer plot, using the swimmer_plot function. I enter the following code:
as.character <- HN_outcomes_no_columns$Patient number
as.numeric <-HN_outcomes_no_columns$Time
swimmer_plot(df=HN_outcomes_no_columns, id=Patient number
, end=Time, fill='lightblue',width=.85)
but get the following error message : Can't subset columns that don't exist.
x Locations 5, 6, 7, 8, 9, etc. don't exist.
i There are only 4 columns
Here is my Reproducible dataset as below (using datapasta package)
data.frame(
stringsAsFactors = FALSE,
check.names = FALSE,
Patient number
= c(1,2,3,4,5,6,7,8,9,10,
11,12,13,14,15,16,17,18,19),
Time = c(1596,1514,356,2085,1921,
318,83,328,815,1854,159,240,821,720,2315,1800,99,
205,177),
Status = c("2","2","2","2","2","2",
"2","2","2","2","2","2","2","2","2","2","2","2",
"2"),
Notes = c(NA,NA,"Problems with Flap",
NA,NA,"Sarcoma primary",NA,NA,NA,NA,
"advanced cancer",NA,NA,NA,"Admitted due to longstanding epilepsy",
NA,NA,NA,NA)
As you can see I'm very new, only a few days since i've started using Rstudio. ..these are outcomes for cancer patients, so some columns have incomplete information..but I'm not sure this matters, as the Swimmer plot, I presume, only needs the 'Time' and 'Patient Number' variables for computation. The patient number variable is simply their assigned number (as I anonymised their hospital number) and Time = survival in days. I'm really not sure where I'm going wrong here.