libData: Read data from installed packages

Description Usage Arguments Value Examples

View source: R/libData.R

Description

Read data via utils::data and import it into R. The ui includes a "show documentation" button to give info about the datasets.

Usage

1
2
3
4
libData(input, output, session, assignTo = "dt",
  ignoreStyleSheet = TRUE)

libDataUI(id, selected = "datasets")

Arguments

input, output, session

Standard module parameters.

assignTo

A character vector of length one. The symbol to assign the data to in the code.

ignoreStyleSheet

By default, the R documentation pages use a special css sheet for styling. Set this option to FALSE to load this style sheet.

id

The module identifier.

selected

The R package initially selected in the GUI.

Value

A reactive string representing the import of the dataset. for example.

1
"data('Arthritis', package = 'vcd')\ndt <- Arthritis"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 

shinyApp(
  ui = fluidPage(
    libDataUI("import"),
    codeOutput("code"),
    dataTableOutput("table")
  ),
  server = function(input, output, session){
    code <- callModule(libData, "import")
    output$code <- renderCode(code())
    output$table <- renderDataTable({
      eval(parse(text = code()))
      dt
    })
  }
)


## End(Not run)

statistikat/codeModules documentation built on Feb. 17, 2021, 11:42 a.m.