Package shiny.router

Similar documents
Package shiny.semantic

Package messaging. May 27, 2018

Package shinyhelper. June 21, 2018

Package regexselect. R topics documented: September 22, Version Date Title Regular Expressions in 'shiny' Select Lists

Package datasets.load

Package spark. July 21, 2017

Package knitrprogressbar

Package available. November 17, 2017

Package jstree. October 24, 2017

Package ipc. January 12, 2019

Package rcmdcheck. R topics documented: November 10, 2018

Package redux. May 31, 2018

Package repec. August 31, 2018

Package d3plus. September 25, 2017

Package sessioninfo. June 21, 2017

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package slickr. March 6, 2018

Package editdata. October 7, 2017

Package robotstxt. November 12, 2017

Package canvasxpress

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package crossword.r. January 19, 2018

Package jug. April 13, 2017

Package clipr. June 23, 2018

Package gtrendsr. August 4, 2018

Package postal. July 27, 2018

Package data.world. April 5, 2018

Package fastdummies. January 8, 2018

Package dbx. July 5, 2018

Package spelling. December 18, 2017

Package librarian. R topics documented:

Package gtrendsr. October 19, 2017

Package sigmanet. April 23, 2018

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package docxtools. July 6, 2018

Package WordR. September 7, 2017

Package cli. November 5, 2017

Package autoshiny. June 25, 2018

Package comparedf. February 11, 2019

Package memoise. April 21, 2017

Package loggit. April 9, 2018

Package semantic.dashboard

Package ether. September 22, 2018

Package dkanr. July 12, 2018

Package validara. October 19, 2017

Package wdman. January 23, 2017

Package shinytest. May 7, 2018

Package catchr. R topics documented: December 30, Type Package. Title Catch, Collect, and Raise Conditions. Version 0.1.0

Package guardianapi. February 3, 2019

Package kirby21.base

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package statsdk. September 30, 2017

Package phuse. January 2, 2019

Package urltools. October 17, 2016

Package shinyaframe. November 26, 2017

Package tidyimpute. March 5, 2018

Package fastqcr. April 11, 2017

Package IRkernel. January 7, 2019

Package htmlwidgets. July 10, 2017

Package htmltidy. September 29, 2017

Package bigreadr. R topics documented: August 13, Version Date Title Read Large Text Files

Package effectr. January 17, 2018

Package wikitaxa. December 21, 2017

Package rtext. January 23, 2019

Package SEMrushR. November 3, 2018

Package oec. R topics documented: May 11, Type Package

Package fingertipsr. May 25, Type Package Version Title Fingertips Data for Public Health

Package tfruns. February 18, 2018

Package httpcache. October 17, 2017

Package githubinstall

Package ezknitr. September 16, 2016

Package htmlwidgets. February 25, 2016

Package ECctmc. May 1, 2018

Package cosinor. February 19, 2015

Package routr. October 26, 2017

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package mapedit. R topics documented: March 2, Title Interactive Editing of Spatial Data in R

Package rbraries. April 18, 2018

Package callr. August 29, 2016

Package RODBCext. July 31, 2017

Package plumber. December 2, 2017

Package linkspotter. July 22, Type Package

Package processanimater

Package zeallot. R topics documented: September 28, Type Package

Package zip. R topics documented: March 11, Title Cross-Platform 'zip' Compression Version 2.0.1

Package shinyfeedback

Package corenlp. June 3, 2015

Package styler. December 11, Title Non-Invasive Pretty Printing of R Code Version 1.0.0

Package phrasemachine

Package sankey. R topics documented: October 22, 2017

Package rwars. January 14, 2017

Package mdftracks. February 6, 2017

Package collapsibletree

Package promote. November 15, 2017

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package opencage. January 16, 2018

Package projector. February 27, 2018

Package goodpractice

Package ssh. June 4, 2018

Package GetoptLong. June 10, 2018

Transcription:

Type Package Title Basic Routing for Shiny Web Applications Version 0.1.1 Author Filip Stachura <filip@appsilon.com> Package shiny.router September 18, 2018 Maintainer Dominik Krzemiński <dominik@appsilon.com> The minimal router for your Shiny apps. It allows you to create dynamic web applications with realtime user interface and easily share URLs to pages within your Shiny apps. Encoding UTF-8 LazyData true License MIT + file LICENSE Imports magrittr, shiny RoxygenNote 6.0.1 Suggests testthat NeedsCompilation no Repository CRAN Date/Publication 2018-09-18 08:50:07 UTC R topics documented: callback_mapping...................................... 2 change_page........................................ 2 cleanup_hashpath...................................... 3 create_router_callback................................... 3 extract_link_name...................................... 4 get_page........................................... 4 get_query_param...................................... 5 is_page........................................... 5 log_msg........................................... 6 make_router......................................... 6 page404........................................... 7 1

2 change_page PAGE_404_ROUTE.................................... 7 parse_url_path........................................ 8 route............................................. 8 router_ui........................................... 9 route_link.......................................... 10 valid_path.......................................... 10 Index 11 callback_mapping Create a mapping bewtween a ui element and a server callack Create a mapping bewtween a ui element and a server callack callback_mapping(ui, server = NA) ui server Valid Shiny user interface. Function that is called within the global server function if given change_page Change the currently displayed page. Works by sending a message up to our reactive input binding on the clientside, which tells page.js to update the window URL accordingly, then tells clientside shiny that our reactive input binding has changed, then that comes back down to our router callback function and all other observers watching get_page() or similar. change_page(page, session = shiny::getdefaultreactivedomain(), mode = "push") page session mode The new URL to go to. Should just be the path component of the URL, with optional query, e.g. "/learner?id=%d" The current Shiny session. ("replace" or "push") whether to replace current history or push a new one. More in shiny::updatequerystring.

cleanup_hashpath 3 cleanup_hashpath Formats a URL fragment into a hashpath starting with "#!/" Formats a URL fragment into a hashpath starting with "#!/" cleanup_hashpath(hashpath) hashpath character with hash path create_router_callback Internal function creating a router callback function. One need to call router callback with Shiny input and output in server code. Internal function creating a router callback function. One need to call router callback with Shiny input and output in server code. create_router_callback(root, routes) root routes Main route to which all invalid routes should redirect. A routes (list). Router callback.

4 get_page extract_link_name Extract link name Strips off the first 3 character, assuming that they are: "#!/". extract_link_name(path) path character with link path stripped link get_page Convenience function to retrieve just the "page" part of the input. This corresponds to what might be called the "path" component of a URL, except that we re using URLs with hashes before the path & query (e.g.: http://www.example.com/#!/virtual/path?and=params) Convenience function to retrieve just the "page" part of the input. This corresponds to what might be called the "path" component of a URL, except that we re using URLs with hashes before the path & query (e.g.: http://www.example.com/#!/virtual/path?and=params) get_page(session = shiny::getdefaultreactivedomain()) session The current Shiny Session The current page in a length-1 character vector, or FALSE if the input has no value.

get_query_param 5 get_query_param Convenience function to retrieve any params that were part of the requested page. The param values returned come from "httr::parse_url()" Convenience function to retrieve any params that were part of the requested page. The param values returned come from "httr::parse_url()" get_query_param(field = NULL, session = shiny::getdefaultreactivedomain()) field session If provided, retrieve only a param with this name. (Otherwise, return all params) The Shiny session The full list of params on the URL (if any), as a list. Or, the single requested param (if present). Or NULL if there s no input, or no params. is_page Is page Tell the reactive chain to halt if we re not on the specified page. Useful for making sure we don t waste cycles re-rendering the UI for pages that are not currently displayed. is_page(page, session = shiny::getdefaultreactivedomain(),...) page The page to display. Should match one of the paths sent to the session Shiny session... Other parameters are sent through to shiny::req() router.

6 make_router log_msg Helper function to print out log messages into Shiny using cat() and stderr(), as described on https://shiny.rstudio.com/articles/debugging.html Because this can print a lot, it s silent unless the shiny.router.debug option is set. log_msg(...)... All params get passed through to cat(). They re automatically wrapped in shiny::isolate(), so you can print reactive values here without too much worry. make_router Creates router. Returned callback needs to be called within Shiny server code. Creates router. Returned callback needs to be called within Shiny server code. make_router(default,...) default Main route to which all invalid routes should redirect.... All other routes defined with shiny.router::route function. Shiny router callback that should be run in server code with Shiny input and output lists. ## Not run: router <- make_router( route("/", root_page), route("/other", other_page) ) ## End(Not run)

page404 7 page404 404 page The page which appear when path is wrong. page404(page = NULL, message404 = NULL) page message404 shiny page style, eg. div(h1("not found")) message to display at the 404 website page404() # div(h1("not found")) page404(message404 = "ABC") # div(h1("abc")) PAGE_404_ROUTE Default 404 page This is default 404 page. PAGE_404_ROUTE Format An object of class character of length 1.

8 route parse_url_path Parse url and build GET parameters list Extract info about url path and parameters that follow? sign. parse_url_path(url_path) url_path character with link url Details parse_url_path allows parsing paramaters lists from url. See more in examples. list containing two objects: path query, a list parse_url_path("?a=1&b=foo") parse_url_path("?a=1&b[1]=foo&b[2]=bar/#!/") parse_url_path("?a=1&b[1]=foo&b[2]=bar/#!/other_page") parse_url_path("www.foo.bar/#!/other_page") parse_url_path("www.foo.bar?a=1&b[1]=foo&b[2]=bar/#!/other") route Create single route configuration. Create single route configuration. route(path, ui, server = NA)

router_ui 9 path ui server Website route. Valid Shiny user interface. Function that is called as callback on server side A route configuration. ## Not run: route("/", shiny::tags$div(shiny::tags$span("hello world"))) route("/main", div(h1("main page"), p("lorem ipsum."))) ## End(Not run) router_ui Creates an output for router. This configures client side. Call it in your UI Shiny code. In this output ui is going to be rendered according to current routing. Creates an output for router. This configures client side. Call it in your UI Shiny code. In this output ui is going to be rendered according to current routing. router_ui() Shiny tags that configure router and build reactive but hidden input _location. ## Not run: ui <- shinyui(fluidpage( router_ui() )) ## End(Not run)

10 valid_path route_link Route link Adds /#!/ prefix to link. Route link Adds /#!/ prefix to link. route_link(path) path character with path route link route_link("abc") # /#!/abc valid_path Internal function that validates that path is defined in routes. Internal function that validates that path is defined in routes. valid_path(routes, path) routes path A routes (list). A path. Boolean value indicating if path is defined.

Index Topic datasets PAGE_404_ROUTE, 7 callback_mapping, 2 change_page, 2 cleanup_hashpath, 3 create_router_callback, 3 extract_link_name, 4 get_page, 4 get_query_param, 5 is_page, 5 log_msg, 6 make_router, 6 page404, 7 PAGE_404_ROUTE, 7 parse_url_path, 8 route, 8 route_link, 10 router_ui, 9 valid_path, 10 11