fragla / eq5d

Other
21 stars 4 forks source link

Possible bug in the shiny app... csv not recognised #21

Closed aghaynes closed 2 years ago

aghaynes commented 2 years ago

I just tried to upload a csv (generated by write.csv) to your shiny app and was presented with the following error... grafik This was using the CRAN version of the package on R 4.1.1

Having switched to xlsx, the import then works, but i get another error on the Data tab: grafik After manually loading VT and CW datasets (VT <- eq5d:::VT - data(VT) did not work..., even if i specified the package) the app worked. You could also explicitly refer to them in the shiny app (eq5d:::VT)

> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252    LC_MONETARY=German_Switzerland.1252
[4] LC_NUMERIC=C                        LC_TIME=German_Switzerland.1252    

attached base packages:
[1] tools     stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] PMCMRplus_1.9.4       FSA_0.9.3             shinyWidgets_0.6.0    reshape2_1.4.4        ggiraphExtra_0.3.0   
 [6] readxl_1.3.1          mime_0.12             DT_0.18               shinycssloaders_1.0.0 ggiraph_0.7.10       
[11] shiny_1.6.0           eq5d_0.11.0           patchwork_1.1.1       sse_0.7-17            forcats_0.5.1        
[16] stringr_1.4.0         dplyr_1.0.8           purrr_0.3.4           readr_2.1.2           tidyr_1.2.0          
[21] tibble_3.1.6          ggplot2_3.3.5         tidyverse_1.3.1      
fragla commented 2 years ago

This sounds like two separate issues. I'm unable to replicate the error using csv files, which are working for me. If you can share your file I can take a look. The "VT" error was introduced in the last release and has been fixed in the development version, but hasn't made it to the CRAN version yet. You can install the dev version using devtools::install_github("fragla/eq5d").

aghaynes commented 2 years ago

I trimmed it down to remove a load of other variables and observations and it still doesnt work, even with the github version, so here's a tiny little csv... tmp2.csv (the VT error went away though, as you said) :)

fragla commented 2 years ago

OK, so the default column names for the EQ-5D dimensions are MO, SC, UA, PD and AD. If I change your dimension column names to these it works for me. When the default columns aren't present a pop-up window appears to enable you to specify the columns for each dimension. However, this doesn't work for your file and the pop-up box just keeps reappearing. I've tested the application using a test file I created a while ago with the column names Mobility, SelfCare, Activities, Pain and Anxiety and it works for that so I'm not sure why your file should be any different (I've tried removing the underscores, but still get the error). Leave it with me and I'll take a look into it. Hopefully if you use the default column names you can carry on using it until I fix it.

aghaynes commented 2 years ago

i exported to xlsx and it works as you've just described... (pop up to select the variable names, I should probably also point out that the values are also coded incorrectly - 0:4 instead of 1:5, i discovered that once i got the shiny app running...)

long term I'll be using the eq5d function directly. I was just trying out the shiny app to get a feel for the package, so consider this issue rather something for you than anything that I particularly need.

fragla commented 2 years ago

So it looks like it's the incorrect coding that causes the issue. If I recode the scores as 1:5 the csv works. I'll make the error messages clearer.