Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/statistikat/codeModules
Shiny modules for reproducible R code
https://github.com/statistikat/codeModules
Last synced: about 2 months ago
JSON representation
Shiny modules for reproducible R code
- Host: GitHub
- URL: https://github.com/statistikat/codeModules
- Owner: statistikat
- Created: 2018-03-28T12:16:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-18T13:42:17.000Z (almost 4 years ago)
- Last Synced: 2024-08-03T03:02:17.680Z (5 months ago)
- Language: R
- Homepage: https://statistikat.github.io/codeModules
- Size: 230 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- awesome-shiny-extensions - codeModules - Shiny modules to import/manipulate/export tabular data, download plots/tables/widgets, and output code with syntax highlighting using highlight.js. (UI Components / Special Input)
- jimsghstars - statistikat/codeModules - Shiny modules for reproducible R code (R)
README
---
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.