-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
47 lines (34 loc) · 1.68 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---
title: "codeModules"
output: github_document
---
[![Travis build status](https://travis-ci.org/statistikat/codeModules.svg?branch=master)](https://travis-ci.org/statistikat/codeModules)
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## About
This R package consists of several [shiny modules](https://shiny.rstudio.com/articles/modules.html) that
return R code in the form of `reactive` characters. All those modules represent common operations regarding
* Import of data (`read.csv`, `read.xlsx`, `data()`, ...)
* Manipulation of data (rename columns, change column classes, filtering)
* export of data (`write.csv`, `write.xlsx`, ...)
## Usage
Always save the output from `callModule` into a variable when working with modules from this package.
The outputs can then be parsed as R code using `eval(parse(text = code()))` or `evalCode`.
```{r cars, eval = FALSE}
## context: server.R
code <- callModule(libData, id = "some_id", assignTo = "dt")
output$table <- renderTable({
evalCode(code())
})
```
## Implemented Modules
* **`libData`**: read data from `R` packages using `utils::data`
* **`readData`**: read data from a file using `read.csv`, `read.xlsx` or others depending on the file-extension.
* **`variableView`** Rename columns, filter data and change column types. The
layout is oriented on the "variable view" in SPSS
* **`ggDownload`** Download `ggplot` with custom height, width and file-type (`png`, `jpeg`, ...)
* **`downloadTable`** Download tables (usually `data.frames`) as `csv`, `xlsx`, `rds`.
## Other functions
* **`renderCode`/`codeOutput`** Show code with syntax highlighting.
* **`evalCode`** Wrapper for `eval(parse(text = .))` with error popups.