Closed kyp0717 closed 7 years ago
Hi, first, glad you trying to use it!
Now, to you problem: if I understand correctly, you have a data.frame 'patient1' that has a column 'SVCDATE' that you converted to be of type 'Date' (i.e., class(patient1$SVCDATE) is 'Date')? If this is so, I would greatly appreciate if you could provide that patient1 data,frame (as an .RData object) so I can try to replicate the issue (of course, if the content is not confidential, etc.)
Best, Dan
Hi Dan,
Thank you for your package. It is very helpful.
The test data you requested attached in an email through Gmail. I could not send it to you through GitHub. Data are de-identified for confidentiality.
Yes, the column 'SVCDATE' is of class 'Date'. Perhaps I may be wrong but I checked it several times. Perhaps I am doing something wrong.
thanks, Ky
Indeed, this is a bug in plotting (as opposed to computing) the CMAs due to the assumption that the event dates are always characters objects of the given date.fromat format, resulting in failure when they were actually contained in a Date
column in the data.frame
.
It is fixed now in the GitHub repository and will be included in the next version on CRAN, but there is a very easy workaround:
always make sure the event date column in the original data is a string of the desired format (possibly by converting it from Data
objects)!
i.e., if d
is your data.frame
and your.event.date.column
is the name of the column containing the event dates in there and it is of type Date
(e.g., as imported from SAS by haven
's read_sas()
function), then make sure you do:
d$your.event.date.column <- as.character(d$your.event.date.column, format="%d/%m/%Y)
or whatever other date format you prefer.
Hi. I just started using your package. I ran into the following issue. Can you help?
cma0 <- CMA0(data=patient1, ID.colname="ENROLID", event.date.colname="SVCDATE", event.duration.colname="DAYSUPP", event.daily.dose.colname="perday", medication.class.colname="category", followup.window.start=0, # FUW start in days since earliest event observation.window.start=182, # OW start in days since earliest event observation.window.duration=365 # OW duration in day
date.format="%m/%d/%Y"
plot(cma0, # the object to plot align.all.patients=TRUE) # align all patients for easier comparison ` Error Message: Error in as.Date.default(cma$data[, cma$event.date.colname], format = cma$date.format) : do not know how to convert 'cma$data[, cma$event.date.colname]' to class “Date”
Please note that patient1$SVCDATE is of class DATE.