shake_shiny_outputs: Shake syntax tree for shiny output-relevant code

Description Usage Arguments Value Examples

Description

Shake syntax tree for shiny output-relevant code

Usage

1
2
shake_shiny_outputs(code, ..., dots = list(), keep_returns = FALSE,
  verbose = getOption("scriptgloss.verbose"))

Arguments

code

a list of lines of code for shaking

...

names of elements of shiny output object to shake for

dots

additional ellipses arguments as list

keep_returns

whether to prune return statements if they arent' needed for generated specified outputs. this is generally useful in situations where a specific output is desired, but unwanted when generated compelete nested module code.

verbose

logical indicating whether to print descriptive code output indicating which lines were selected for inclusion

Value

the code_list with isolated expressions in the syntax tree pruned

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
code <- quote({
  library(utils)
  require(stats)
  
  output <- list()
  
  a <- 'This is unused in global scope'
  x <- 'this is a default value'
  output$a <- function(a, b = x) {
    return(a)
  }
  
  output$b <- function(c) {
    return(c)
  }
})

scriptgloss:::shake_shiny_outputs(code, "b")

dgkf/scriptgloss documentation built on June 8, 2019, 8:43 p.m.