flexdashboard icon indicating copy to clipboard operation
flexdashboard copied to clipboard

crosstalk::filter_slider() must go first, otherwise flexdashboard breaks?

Open luke-a opened this issue 8 years ago • 2 comments

The following crosstalk seems to break a flexdashboard:

---
output: 
  flexdashboard::flex_dashboard
---

```{r setup, include=FALSE}
library(flexdashboard)
library(crosstalk)
library(summarywidget)
set.seed(1)
df <- data.frame(
  x = seq(Sys.Date()-364, Sys.Date(), length.out = 99), 
  y = 1:99,
  group = gl(3,33)
) 
sd <- SharedData$new(df)
```

```{r}
filter_checkbox("chkb", "Checkbox", sd, ~group, inline = TRUE)
filter_slider("sldr", "Slider", sd, ~x)
summarywidget(sd, "sum", "y")
```

2017-06-05_013348

This works as expected - note that I only switched filter_checkbox and filter_slider:

---
output: 
  flexdashboard::flex_dashboard
---
```{r setup, include=FALSE}
library(flexdashboard)
library(crosstalk)
library(summarywidget)
set.seed(1)
df <- data.frame(
  x = seq(Sys.Date()-364, Sys.Date(), length.out = 99), 
  y = 1:99,
  group = gl(3,33)
)
sd <- SharedData$new(df)
```

```{r}
filter_slider("sldr", "Slider", sd, ~x)
filter_checkbox("chkb", "Checkbox", sd, ~group, inline = TRUE)
summarywidget(sd, "sum", "y")
```

2017-06-05_013113

My sessionInfo():

R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

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

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

other attached packages:
 [1] htmltools_0.3.6          crosstalk_1.0.0          summarywidget_0.0.0.9000 forcats_0.2.0            rCharts_0.4.5            email_1.0               
 [7] stringi_1.1.2            magrittr_1.5             fastmatch_1.1-0          data.table_1.10.4        bit64_0.9-5              bit_1.1-12              
[13] lubridate_1.6.0          plotly_4.7.0.9000        flexdashboard_0.5        DT_0.2                   quantmod_0.4-8           TTR_0.23-1              
[19] xts_0.9-7                zoo_1.7-14               bindrcpp_0.1             dplyr_0.6.0              purrr_0.2.2.2            readr_1.0.0             
[25] tidyr_0.6.3              tibble_1.3.3             ggplot2_2.2.1.9000       tidyverse_1.0.0         

loaded via a namespace (and not attached):
 [1] lattice_0.20-34     colorspace_1.3-2    viridisLite_0.2.0   yaml_2.1.14         rlang_0.1.1         glue_1.0.0.9000     bindr_0.1           plyr_1.8.4         
 [9] stringr_1.1.0       munsell_0.4.3       gtable_0.2.0        htmlwidgets_0.8     evaluate_0.10       labeling_0.3        knitr_1.15.1        httpuv_1.3.3       
[17] Rcpp_0.12.11        xtable_1.8-2        backports_1.0.4     scales_0.4.1.9000   jsonlite_1.4        mime_0.5            digest_0.6.12       shiny_1.0.3        
[25] RJSONIO_1.3-0       grid_3.3.2          rprojroot_1.1       tools_3.3.2         lazyeval_0.2.0.9000 whisker_0.3-2       pkgconfig_2.0.1     rsconnect_0.7      
[33] assertthat_0.2.0    rmarkdown_1.3       httr_1.2.1          R6_2.2.1  

luke-a avatar Jun 04 '17 23:06 luke-a

@jcheng5 Any thoughts on what could be going on here?

jjallaire avatar Jun 05 '17 14:06 jjallaire

This was my problem too. No idea why it does this but thanks for the workaround.

gdmcdonald avatar Jul 08 '20 03:07 gdmcdonald