Title: | Access Reactive Data Interactively |
Version: | 0.2.0 |
Description: | Troubleshooting reactive data in 'shiny' can be difficult. These functions will convert reactive data frames into functions and load all assigned objects into your local environment. If you create a dummy input object, as the function will suggest, you will be able to test your server and ui functions interactively. |
BugReports: | https://github.com/rjake/shinyobjects/issues |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0.9000 |
Imports: | dplyr, glue, knitr, magrittr, methods, pander, purrr, readr, rlang, rstudioapi, shiny, stringr, styler, tibble, tidyr |
VignetteBuilder: | knitr |
Suggests: | rmarkdown, testthat, mockery, spelling, covr |
Language: | en-US |
NeedsCompilation: | no |
Packaged: | 2020-07-29 05:05:00 UTC; foxtr |
Author: | Jake Riley [aut, cre] |
Maintainer: | Jake Riley <rjake@sas.upenn.edu> |
Repository: | CRAN |
Date/Publication: | 2020-07-29 05:50:02 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Convert and load the highlighted assignment to your environment
Description
After highlighting the assignment in the source editor, go to the console and run this function. The selected code will be run and if it is reactive, it will be loaded as a function.
Usage
convert_selection(envir = NULL)
Arguments
envir |
the environment shinyobjects should the load the objects into. |
Load inputs and convert reactive functions from an R/Rmd script to your environment
Description
This function will run all assignments of your R or Rmd. file In the process, this function will encourage the creation of a dummy input
list that will mimic user input and allow your code to run. Lastly, reactive objects are converted to functions so they can still be called as df()
etc.
Usage
load_reactive_objects(
file,
restart = FALSE,
envir = NULL,
clear_environment = FALSE,
keep = NULL
)
Arguments
file |
Rmd to be evaluated and loaded into your environment |
restart |
When |
envir |
the environment shinyobjects should the load the objects into. |
clear_environment |
When |
keep |
a regular expression of objects to keep when |
Warning
This function has the ability to overwrite your objects in your environment. Make sure you understand how this function works before moving forward.
Examples
if (interactive()) {
system.file(package = "shinyobjects", "Rmd/test_dashboard.Rmd") %>%
load_reactive_objects()
system.file(package = "shinyobjects", "Rmd/test_dashboard_no_inputs.Rmd") %>%
load_reactive_objects()
system.file(package = "shinyobjects", "Rmd/test_dashboard_missing_inputs.Rmd") %>%
load_reactive_objects()
}
Show UI output in viewer pane
Description
Show UI output in viewer pane
Usage
view_ui(x, close_after = 5)
Arguments
x |
ui content (actionButton, selectInput, valueBox), if x is not provided, |
close_after |
number of seconds to display UI in Viewer panel. If NULL, app must be stopped manually before more code can be run. |
Examples
if (interactive()) {
# run this line
shiny::selectInput(
"state",
"Choose a state:",
list(
`East Coast` = list("NY", "NJ", "CT"),
`West Coast` = list("WA", "OR", "CA"),
`Midwest` = list("MN", "WI", "IA")
)
)
# the output will automatically be used here
view_ui(close_after = 6)
}