Closed gustavorps closed 5 years ago
Hi Gustavo, I tried to reproduce it and everything seems to work fine? Which version of AdhereR are you using and on which platform? Best, Dan
Hello @ddediu
I'm using rstudio.cloud
version
commandplatform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 5.2
year 2018
month 12
day 20
svn rev 75870
language R
version.string R version 3.5.2 (2018-12-20)
nickname Eggshell Igloo
sessionInfo()
functionR version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS
Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8
[5] LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] readr_1.3.1 AdhereR_0.4.1 stringr_1.4.0 R.utils_2.8.0 R.oo_1.22.0 R.methodsS3_1.7.1
[7] read.dbc_1.0.5 optparse_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 cellranger_1.1.0 pillar_1.4.1 later_0.8.0 compiler_3.5.2
[6] colourpicker_1.0 shinyjs_1.0 shinyWidgets_0.4.8 forcats_0.4.0 tools_3.5.2
[11] highlight_0.4.7.2 digest_0.6.19 bit_1.1-14 viridisLite_0.3.0 tibble_2.1.3
[16] jsonlite_1.6 RSQLite_2.1.1 memoise_1.1.0 pkgconfig_2.0.2 rlang_0.3.4
[21] shiny_1.3.2 DBI_1.0.0 curl_3.3 haven_2.1.0 xfun_0.7
[26] xml2_1.2.0 RMariaDB_1.0.6 knitr_1.23 readODS_1.6.7 htmlwidgets_1.3
[31] hms_0.4.2 bit64_0.9-7 getopt_1.20.3 data.table_1.12.2 R6_2.4.0
[36] readxl_1.3.1 clipr_0.6.0 blob_1.1.1 magrittr_1.5 scales_1.0.0
[41] promises_1.0.1 htmltools_0.3.6 colorspace_1.4-1 xtable_1.8-4 mime_0.6
[46] httpuv_1.5.1 V8_2.2 stringi_1.4.3 miniUI_0.1.1.1 munsell_0.5.0
[51] crayon_1.3.4
# Load the AdhereR library:
library(AdhereR);
library(readr)
MyExamplePats <- read_csv("/cloud/project/MyExamplePats.csv")
# https://cran.r-project.org/web/packages/AdhereR/vignettes/AdhereR-overview.html#the-simple-cmas
knitr::kable(MyExamplePats, caption = "<a name=\"Table-1\"></a>**Table 1.** Medication events for two example patients");
# Create an object "cma0" of the most basic CMA type, "CMA0":
cma0v1 <- CMA0(
data=MyExamplePats, # use the two selected patients
ID.colname="PATIENT_ID", # the name of the column containing the IDs
event.date.colname="DATE", # the name of the column containing the event date
event.duration.colname="DURATION", # the name of the column containing the duration
event.daily.dose.colname="PERDAY", # the name of the column containing the dosage
medication.class.colname="CATEGORY", # the name of the column containing the category
followup.window.start=0, # FUW start in days since earliest event
observation.window.start=0, # OW start in days since earliest event
observation.window.duration=365*2, # OW duration in days
date.format="%d/%m/%Y"); # date format (mm/dd/yyyy)
# Plot the object (CMA0 shows the actual event data only):
plot(cma0v1, # the object to plot
align.all.patients=FALSE); # align all patients for easier comparison
| PATIENT_ID| DURATION|DATE | PERDAY|CATEGORY |
|----------:|--------:|:----------|------:|:----------|
| 1| 30|20/06/2016 | 1|Coquetel A |
| 1| 60|11/07/2016 | 1|Coquetel A |
| 1| 60|21/09/2016 | 1|Coquetel A |
| 1| 60|14/02/2017 | 1|Coquetel A |
| 1| 60|20/03/2017 | 1|Coquetel A |
| 1| 60|04/09/2017 | 1|Coquetel A |
| 1| 60|13/12/2017 | 1|Coquetel A |
| 1| 30|06/03/2018 | 1|Coquetel A |
| 1| 30|17/04/2018 | 1|Coquetel A |
| 1| 60|23/05/2018 | 1|Coquetel A |
| 1| 30|20/06/2018 | 1|Coquetel A |
| 1| 60|15/08/2018 | 1|Coquetel A |
| 1| 60|18/10/2018 | 1|Coquetel A |
| 1| 30|26/11/2018 | 1|Coquetel A |
| 1| 60|18/01/2019 | 1|Coquetel A |
| 1| 60|18/03/2019 | 1|Coquetel A |
>
> # Create an object "cma0" of the most basic CMA type, "CMA0":
> cma0v1 <- CMA0(
+ data=ExamplePatsPatricia, # use the two selected patients
+ ID.colname="PATIENT_ID", # the name of the column containing the IDs
+ event.date.colname="DATE", # the name of the column containing the event date
+ event.duration.colname="DURATION", # the name of the column containing the duration
+ event.daily.dose.colname="PERDAY", # the name of the column containing the dosage
+ medication.class.colname="CATEGORY", # the name of the column containing the category
+ followup.window.start=0, # FUW start in days since earliest event
+ observation.window.start=0, # OW start in days since earliest event
+ observation.window.duration=365*2, # OW duration in days
+ date.format="%d/%m/%Y"); # date format (mm/dd/yyyy)
>
> # Plot the object (CMA0 shows the actual event data only):
> plot(cma0v1, # the object to plot
+ align.all.patients=FALSE); # align all patients for easier comparison
Error in rect(adh.plot.space[2] + as.numeric(cma$data$.FU.START.DATE[s[1]] - :
cannot mix zero-length and non-zero-length coordinates
Hi again,
I've been trying for the past few hours to install AdhereR in a 3.5.2 environment on Rstudio.cloud but reader fails (which means that readODS fails which means that I can't install AdhereR) --> how did you manage to do it???
Dan
Hi again,
I've been trying for the past few hours to install AdhereR in a 3.5.2 environment on Rstudio.cloud but reader fails (which means that readODS fails which means that I can't install AdhereR) --> how did you manage to do it???
Dan
Sorry for the delay @ddediu
On the console:
install.packages("AdhereR")
or
Menu > Tools > Install Packages...
Hi,
yes, sure, I know how to do that :p but it turns out the issue was that I selected by mistake R 3.2.5 which is on a much-too-old OS for all packages to compile :)
So, now I did compile AdhereR under the right version of R (3.5.3) and ran your code on your data, but the plotting works just fine (I am using AdhereR 0.5)
So, what do we do differently?
Best, Dan
Good question. What we do differently?
I create a project from zero on rstudio.cloud execute these steps:
test.R
install.packages(c("AdhereR", "knitr", "readr"))
MyExamplePats <- read_csv("/cloud/project/MyExamplePats.csv")
by
MyExamplePats <- read_csv("https://gist.githubusercontent.com/gustavorps/0168f8c776c9943fc3960f8e76cf710a/raw/982353596f83127545fa9e37ac7cedfc89af3e44/MyExamplePats.csv")
Still getting the error
Error in rect(adh.plot.space[2] + as.numeric(cma$data$.FU.START.DATE[s[1]] - :
cannot mix zero-length and non-zero-length coordinates
You can access the project in this link
Hi,
thanks for sharing your project: I just tested it with your code and the issue is... the bloody tibble
returned by read_csv()
:)
The work-around for now is very simple (I added it to you code): simply as.data.frame(MyExamplePats)
when you call CMA0
, but I will fix it in the future version of the package as well...
You can see that I don't use tibble
myself, so I didn't think about it, so thanks a lot for finding this bug!
Best,
Dan
Fixed in the next release (force the data
parameter to CMAx()
to data.frame
)...
Hi, thanks for sharing your project: I just tested it with your code and the issue is... the bloody
tibble
returned byread_csv()
:) The work-around for now is very simple (I added it to you code): simplyas.data.frame(MyExamplePats)
when you callCMA0
, but I will fix it in the future version of the package as well... You can see that I don't usetibble
myself, so I didn't think about it, so thanks a lot for finding this bug! Best, Dan
I still have the same error coming up.
Hi, can you please give a bit more details (maybe even share a minimal reproducible dataset + code) so I can debug it? Thanks, Dan
Dataset
MyExamplePats
Code
Error