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
| ## app.R ## | |
| library(shiny) | |
| library(waiter) | |
| library(shinydashboard) | |
| # add JavaScript to add an id to the <section> tag so we can overlay waiter on top of it | |
| add_id_to_section <- " | |
| $( document ).ready(function() { | |
| var section = document.getElementsByClassName('content'); | |
| section[0].setAttribute('id', 'waiter-content'); |
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
| library(shiny) | |
| library(waiter) | |
| ui <- navbarPage( | |
| "example", | |
| id = "tabs", | |
| header = list( | |
| use_waiter() | |
| ), | |
| tabPanel( |
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
| library(echarts4r) | |
| library(sp) | |
| library(raster) | |
| library(geojsonio) | |
| # get the shapefile | |
| brazil_sp <- raster::getData('GADM', country = 'BRAZIL', level = 3) | |
| # simplify | |
| brazil_small <- rmapshaper::ms_simplify(brazil_sp, keep = 0.05) |
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
| nodes <- sg_make_nodes() | |
| edges <- sg_make_edges(nodes, 17) | |
| # Save image | |
| sigmajs() %>% | |
| sg_nodes(nodes, id, size) %>% | |
| sg_edges(edges, id, source, target) %>% | |
| sg_export_img() %>% # bind to button | |
| sg_button("export_img", "download") # click button to obtain png | |
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
| library(shiny) | |
| library(cicerone) | |
| guide <- Cicerone$ | |
| new(animate = F)$ | |
| step( | |
| el = "text_inputId", | |
| title = "Text Input", | |
| description = "This is where you enter the text you want to print." | |
| )$ |
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
| library(echarts4r) | |
| # e_grid also accepts percentages | |
| # e.g.: e_grid(left = "5%") | |
| # useful for better responsiveness (mobile/desktop) | |
| mtcars %>% | |
| tibble::rownames_to_column() %>% | |
| e_charts(rowname) %>% | |
| e_line(qsec) %>% |
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
| // Place your key bindings in this file to overwrite the defaults | |
| [ | |
| { | |
| "key": "ctrl+shift+m", | |
| "command": "editor.action.insertSnippet", | |
| "args": { | |
| "snippet": " %>% " | |
| } | |
| }, | |
| { |
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
| #' Compile an R file into a JS file | |
| #' @param input A character string; the input file. | |
| #' @param output A character string; the output file. When the | |
| #' output is "", the result is printed to the standard output. | |
| #' @export | |
| compile_r <- function(input) { | |
| input <- rlang::enexpr(input) | |
| parse(text = deparse(input)) %>% | |
| purrr::map(rewrite) %>% | |
| purrr::map(deparse_js) %>% |
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
| library(shiny) | |
| # remotes::install_github("JohnCoene/nter") | |
| addResourcePath( | |
| 'www', 'assets' | |
| ) | |
| login_form <- modalDialog( | |
| fluidRow( | |
| column(9, passwordInput("password", "Password", width = "100%")), |
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
| library(echarts4r) | |
| # frequencies | |
| tf <- tibble::tibble( | |
| phrases = c("anomaly trip", "a sentence", "some phrase", "another sentence"), | |
| frequency = c(10, 20, 30) | |
| ) | |
| # add line break | |
| tf$phrases <- gsub(" ", "\n", tf$phrases) |