Last active
August 29, 2015 14:07
-
-
Save daroczig/480af8ad766e96dd25f4 to your computer and use it in GitHub Desktop.
evals demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(pander) | |
evals(readLines('demo.R')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1+1 | |
stop('foo') | |
I love R | |
chisq.test(table(mtcars$am, mtcars$gear)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> library(pander) | |
> evals(readLines('demo.R')) | |
[[1]] | |
$src | |
[1] "1+1" | |
$result | |
[1] 2 | |
$output | |
[1] "[1] 2" | |
$type | |
[1] "numeric" | |
$msg | |
$msg$messages | |
NULL | |
$msg$warnings | |
NULL | |
$msg$errors | |
NULL | |
$stdout | |
NULL | |
attr(,"class") | |
[1] "evals" | |
[[2]] | |
$src | |
[1] "stop('foo')" | |
$result | |
NULL | |
$output | |
NULL | |
$type | |
[1] "error" | |
$msg | |
$msg$messages | |
NULL | |
$msg$warnings | |
NULL | |
$msg$errors | |
[1] "foo" | |
$stdout | |
NULL | |
attr(,"class") | |
[1] "evals" | |
[[3]] | |
$src | |
[1] "I love R" | |
$result | |
NULL | |
$output | |
NULL | |
$type | |
[1] "error" | |
$msg | |
$msg$messages | |
NULL | |
$msg$warnings | |
NULL | |
$msg$errors | |
[1] "Unexpected symbol at character 3 in line 1: ` I love`" | |
$stdout | |
NULL | |
attr(,"class") | |
[1] "evals" | |
[[4]] | |
$src | |
[1] "chisq.test(table(mtcars$am, mtcars$gear))" | |
$result | |
Pearson's Chi-squared test | |
data: table(mtcars$am, mtcars$gear) | |
X-squared = 20.9447, df = 2, p-value = 2.831e-05 | |
$output | |
[1] "" | |
[2] "\tPearson's Chi-squared test" | |
[3] "" | |
[4] "data: table(mtcars$am, mtcars$gear)" | |
[5] "X-squared = 20.9447, df = 2, p-value = 2.831e-05" | |
[6] "" | |
$type | |
[1] "htest" | |
$msg | |
$msg$messages | |
NULL | |
$msg$warnings | |
[1] "Chi-squared approximation may be incorrect" | |
$msg$errors | |
NULL | |
$stdout | |
NULL | |
attr(,"class") | |
[1] "evals" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment