Example

Here is an example of question_bucket(), an experimental function in the parsons package.

library(learnr)
library(parsons)
library(magrittr)

Drag the operating systems into the correct bucket:

supported <-  c("Red Hat", "Ubuntu", "Suse Linux", "CentOS")
unsupported <- c( "Windows Server 2018", "Fedora", "Debian")

question_bucket(
  initial = c(supported, unsupported),
  pass_if(~ contains_all(., supported)),
  fail_if(
    ~ length(.) < 4,
    "Provide at least 4 answers"
  ),
  fail_if(
    ~ length(.) > 4,
    "Provide only 4 answers"
  ),
  fail_if(~ contains_any(., unsupported), 
          message = ~ message_if(which(. %in% unsupported))
  ),
  text = c("Operating systems", "Supported by RStudio Connect")
)


rstudio/parsons documentation built on Nov. 5, 2019, 4:17 a.m.