Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactive plot not showing 'per episode' results #22

Closed
ptityeti opened this issue Nov 29, 2018 · 1 comment
Closed

Interactive plot not showing 'per episode' results #22

ptityeti opened this issue Nov 29, 2018 · 1 comment
Assignees
Labels

Comments

@ptityeti
Copy link

Open interactive shiny plot using following code.

dataset <- structure(list(patientid = c("N05AX07", "N05AX07", "C09CA03", 
                                        "N05AX07", "C09CA03", "C09CA03", "N05AX07", "N05AX07", "N05AX07", 
                                        "A10BA02", "A10BA02", "A10BA02", "C07AB07", "A10BA02", "A10BA02", 
                                        "A10BA02", "A10BA02", "A10BA02", "C09CA03", "A10BA02", "A10BA02", 
                                        "A10BA02", "C07AB07", "A10BA02", "A10BA02", "C07AB07", "A10BA02", 
                                        "C07AB07", "C09CA03", "A10BA02", "A10BA02", "A10BA02", "C09CA03", 
                                        "A10BA02", "A10BA02", "C09CA03", "A10BA02", "C07AB07", "A10BA02", 
                                        "A10BA02", "A10BA02", "A10BA02", "A10BA02", "C07AB07", "C09CA03", 
                                        "A10BA02"), deliverydate = structure(c(16881, 16905, 16905, 16955, 
                                                                               16955, 17050, 17081, 17107, 17108, 17115, 17134, 17136, 17136, 
                                                                               17147, 17147, 17168, 17171, 17175, 17235, 17235, 17255, 17255, 
                                                                               17276, 17283, 17315, 17315, 17319, 17326, 17326, 17326, 17326, 
                                                                               17458, 17458, 17458, 17493, 17569, 17569, 17582, 17582, 17606, 
                                                                               17626, 17649, 17649, 17649, 17649, 17649), class = "Date"), NDays = c(12.5, 
                                                                                                                                                     12.5, 98, 12.5, 98, 98, 12.5, 12.5, 12.5, 20, 20, 20, 50, 20, 
                                                                                                                                                     20, 20, 20, 20, 98, 20, 20, 20, 50, 20, 20, 50, 20, 50, 98, 20, 
                                                                                                                                                     20, 20, 98, 20, 20, 98, 20, 50, 20, 20, 20, 20, 20, 50, 98, 20
                                                                               )), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
                                                                                                                                           -46L))
library(AdhereR)
plot_interactive_cma(data = dataset, ID.colname = 'patientid', event.date.colname = 'deliverydate', event.duration.colname = 'NDays')

This works as expected.

When now selecting "per episode" in the menu "Select CMA type", errors appear:

  • The messages line above the plot says "Plotting patient ID 'A10BA02' with CMA 'per episode' ('CMA1') Error(s): invalid first argument"
  • On the location of the plot the message "Error computing 'per episode' for patient 'A10BA02' (see console for possible warnings or errors)!" appears.

AdhereR version 0.3.1
R version 3.5.1

@ddediu ddediu self-assigned this Dec 3, 2018
@ddediu ddediu added the bug label Dec 3, 2018
@ddediu
Copy link
Owner

ddediu commented Dec 5, 2018

Hi Wouter!
thanks for the bug report and sorry it took me so long (I just came back from yet another travel).
The thing is very simple and boils down to not doing enough consistency checks on the parameter values when computing episodes (now, we spit a much more informative error message).
More precisely, you don't define any medication class column but CMA_per_episode() by default has medication.change.means.new.treatment.episode = TRUE which forces the use of medication class and which, thus, resulted in an ugly crash: now this case is checked and explicitly marked as an error which can be corrected either by providing a medication class name or by setting medication.change.means.new.treatment.episode to FALSE...
These changes will be in the devel branch soon
Best,
Dan

@ddediu ddediu closed this as completed Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants