Last active
August 29, 2015 14:04
-
-
Save ijlyttle/a37bea7952f1ac9f12ba to your computer and use it in GitHub Desktop.
Issues with ggvis, shiny, and rmarkdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| > sessionInfo() | |
| R version 3.1.0 (2014-04-10) | |
| Platform: x86_64-apple-darwin13.1.0 (64-bit) | |
| locale: | |
| [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 | |
| attached base packages: | |
| [1] stats graphics grDevices utils datasets methods base | |
| other attached packages: | |
| [1] ggvis_0.3.0.99 shiny_0.10.1.9000 devtools_1.5 | |
| loaded via a namespace (and not attached): | |
| [1] assertthat_0.1 digest_0.6.4 dplyr_0.2 evaluate_0.5.5 formatR_0.10 htmltools_0.2.4 | |
| [7] httpuv_1.3.0 httr_0.3 knitr_1.6.3 magrittr_1.0.1 memoise_0.2.1 parallel_3.1.0 | |
| [13] Rcpp_0.11.2 RCurl_1.95-4.1 RJSONIO_1.2-0.2 rmarkdown_0.2.50 stringr_0.6.2 tools_3.1.0 | |
| [19] whisker_0.3-2 xtable_1.7-3 yaml_2.1.11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| title: "shiny, rmarkdown, ggvis: fluidRow issue" | |
| author: "Ian Lyttle and Alex Shum" | |
| runtime: shiny | |
| output: | |
| html_document: | |
| theme: united | |
| --- | |
| In this case, run from the command line, both apps render legibly, but ggvis does not appear to wish to conform to the horizontal dimension of the column it is put into. | |
| Run in subApp mode, ggvis respects the horizontal dimension, but does something funny for the vertical dimension. | |
| ```{r} | |
| library(ggvis) | |
| library(shiny) | |
| ``` | |
| ```{r} | |
| app_test2 <- shinyApp( | |
| ui = fluidPage( | |
| fluidRow( | |
| column(3, wellPanel()), | |
| column(3, wellPanel(ggvisOutput("cocaine1"))), | |
| column(3, wellPanel()) | |
| ), | |
| fluidRow( | |
| column(3, wellPanel()), | |
| column(3, wellPanel(ggvisOutput("cocaine2"))), | |
| column(3, wellPanel()) | |
| ) | |
| ), | |
| server = function(input, output, session){ | |
| cocaine %>% | |
| ggvis(x = ~weight, y = ~price) %>% | |
| layer_points() %>% | |
| set_options(width = 250, height = 250) %>% | |
| bind_shiny("cocaine1") | |
| cocaine %>% | |
| ggvis(x = ~weight, y = ~potency) %>% | |
| layer_points() %>% | |
| set_options(width = 250, height = 250) %>% | |
| bind_shiny("cocaine2") | |
| }, | |
| options = list(height = "500") | |
| ) | |
| app_test2 | |
| ``` | |
| ```{r} | |
| app_test3 <- shinyApp( | |
| ui = fluidPage( | |
| fluidRow( | |
| column(3, wellPanel()), | |
| column(6, wellPanel(ggvisOutput("cocaine1"))), | |
| column(3, wellPanel()) | |
| ), | |
| fluidRow( | |
| column(3, wellPanel()), | |
| column(6, wellPanel(ggvisOutput("cocaine2"))), | |
| column(3, wellPanel()) | |
| ) | |
| ), | |
| server = function(input, output, session){ | |
| cocaine %>% | |
| ggvis(x = ~weight, y = ~price) %>% | |
| layer_points() %>% | |
| set_options(width = 250, height = 250) %>% | |
| bind_shiny("cocaine1") | |
| cocaine %>% | |
| ggvis(x = ~weight, y = ~potency) %>% | |
| layer_points() %>% | |
| set_options(width = 250, height = 250) %>% | |
| bind_shiny("cocaine2") | |
| }, | |
| options = list(height = "500") | |
| ) | |
| app_test3 | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment