Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add shinytest files
- Loading branch information
1 parent
0fa92ed
commit a29fd0be103fbcaea496e7ce18432668ade8fb60
Showing
20 changed files
with
4,596 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
BIN
+282 KB
tests/bad-functions-expected/001.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
BIN
+282 KB
tests/bad-functions-expected/002.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| app <- ShinyDriver$new("../") | ||
| app$snapshotInit("bad-functions") | ||
|
|
||
| app$setInputs(table_rows_current = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), allowInputNoBinding_ = TRUE) | ||
| app$setInputs(table_rows_all = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), allowInputNoBinding_ = TRUE) | ||
| app$snapshot() | ||
| app$setInputs(functions = "# From https://github.com/wlandau/drake-examples/blob/master/mtcars/R/functions.R # nolint | ||
| # Pick a random subset of n rows from a dataset | ||
| random_rows <- function(data, n) { | ||
| data[sample.int(n = nrow(data), size = n, replace = TRUE), ] | ||
| # Bootstrapped datasets from mtcars. | ||
| simulate <- function(n) { | ||
| # Pick a random set of cars to bootstrap from the mtcars data. | ||
| data <- random_rows(data = mtcars, n = n) | ||
| # x is the car's weight, and y is the fuel efficiency. | ||
| data.frame( | ||
| x = data$wt, | ||
| y = data$mpg | ||
| ) | ||
| } | ||
| # Try a couple different regression models. | ||
| # Is fuel efficiency linearly related to weight? | ||
| reg1 <- function(d) { | ||
| lm(y ~ + x, data = d) | ||
| } | ||
| # Is fuel efficiency related to the SQUARE of the weight? | ||
| reg2 <- function(d) { | ||
| d$x2 <- d$x ^ 2 | ||
| lm(y ~ x2, data = d) | ||
| }") | ||
| app$setInputs(update = "click") | ||
| app$snapshot() |
Oops, something went wrong.