dreamRs / esquisse

RStudio add-in to make plots interactively with ggplot2
https://dreamrs.github.io/esquisse
Other
1.78k stars 229 forks source link

Strange behavior with options(OutDec = ",") #172

Open a-alexandre opened 3 years ago

a-alexandre commented 3 years ago

Hello,

I have found a strange behavior of esquisse (refusing to launch, or when it does, plot does not render).

I think the issue is because I somtimes use options(OutDec = ',') for printing reasons in Rmarkdown files. Not sure that it is a bug.

data1 <- structure(list(X = c("2019", "2019", "2019", "2019", "2019", 
"2019", "2019", "2019", "2019", "2020", "2020", "2020", "2020", 
"2020", "2020", "2020", "2020", "2020"), pour_facet = c("1", 
"1", "1", "2", "2", "2", "3", "3", "3", "1", "1", "1", "2", "2", 
"2", "3", "3", "3"), fill_var = structure(c(1L, 2L, 3L, 1L, 2L, 
3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("rac", 
"rc", "ro"), class = c("ordered", "factor")), Y = c(1320902.16, 
2113334.39, 888476.78, 999199.29, 1341383.34, 474006.48, 2896349.94, 
3975109.4, 1531865.29, 25356.6500000004, 7652747.56, 2127287.88, 
1203614.26, 1931651.82, 709611.38, 1449320.96, 1671894.36, 568070.61
)), row.names = c(NA, -18L), class = c("tbl_df", "tbl", "data.frame"
))

options(OutDec = ",")

esquisse::esquisser(data1)
#> Error: .onLoad a échoué dans loadNamespace() pour 'shiny', détails :
#>   appel : NULL
#>   erreur : spécification de version incorrecte '1,5'

Created on 2021-07-09 by the reprex package (v0.3.0)

pvictor commented 2 years ago

Hello,

This error is caused by numeric_version(1.5) when loading dependencies and checking version number with something like :

loadNamespace("shiny", versionCheck = list(op = ">=", version = numeric_version(1.5)))

at least from what I understand ^^

A workaround is to explicitly load shiny package before calling esquisse::esquisser(), the error will still appear but esquise should launch and work.

data1 <- structure(list(X = c("2019", "2019", "2019", "2019", "2019", 
"2019", "2019", "2019", "2019", "2020", "2020", "2020", "2020", 
"2020", "2020", "2020", "2020", "2020"), pour_facet = c("1", 
"1", "1", "2", "2", "2", "3", "3", "3", "1", "1", "1", "2", "2", 
"2", "3", "3", "3"), fill_var = structure(c(1L, 2L, 3L, 1L, 2L, 
3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("rac", 
"rc", "ro"), class = c("ordered", "factor")), Y = c(1320902.16, 
2113334.39, 888476.78, 999199.29, 1341383.34, 474006.48, 2896349.94, 
3975109.4, 1531865.29, 25356.6500000004, 7652747.56, 2127287.88, 
1203614.26, 1931651.82, 709611.38, 1449320.96, 1671894.36, 568070.61
)), row.names = c(NA, -18L), class = c("tbl_df", "tbl", "data.frame"
))

options(OutDec = ",")
library(shiny) # <- explicitly load shiny
esquisse::esquisser(data1)

Victor