Skip to content
Permalink
Browse files
Add shinytest files
  • Loading branch information
wlandau-lilly committed May 13, 2019
1 parent 0fa92ed commit a29fd0be103fbcaea496e7ce18432668ade8fb60
Show file tree
Hide file tree
Showing 20 changed files with 4,596 additions and 0 deletions.

Large diffs are not rendered by default.

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.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -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()

0 comments on commit a29fd0b

Please sign in to comment.