dance_recital: Create a matahari-esque data frame from a file.

Description Usage Arguments Examples

View source: R/dance.R

Description

Create a matahari-esque data frame from a file.

Usage

1
dance_recital(code, evaluate = TRUE)

Arguments

code

A string or the path to a file containing R code.

evaluate

Logical, indicating whether to evaluate the code, default is TRUE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(knitr)

# Evaluate a string of R code
kable(dance_recital("x <- 4; x *7"))

## |expr   |value |error |output |warnings     |messages     |
## |:------|:-----|:-----|:------|:------------|:------------|
## |x <- 4 |4     |NULL  |       |character(0) |character(0) |
## |x * 7  |28    |NULL  |       |character(0) |character(0) |

# Evaluate an R script. We have provided an R script for testing purposes.
code_file <- system.file("test", "sample_code.R", package = "matahari")
kable(dance_recital(code_file)[,1:3])

## |expr                |value    |error                                    |
## |:-------------------|:--------|:----------------------------------------|
## |4 + 4               |8        |NULL                                     |
## |wow!                |wow!     |NULL                                     |
## |mean(1:10)          |5.5      |NULL                                     |
## |stop("Error!")      |NULL     |list(message = "Error!", call = .f(...)) |
## |warning("Warning!") |Warning! |NULL                                     |
## |message("Hello?")   |NULL     |NULL                                     |
## |cat("Welcome!")     |NULL     |NULL                                     |

jhudsl/matahari documentation built on Feb. 21, 2020, 9:06 p.m.