Hint and Solution Copy and Paste

knitr::opts_chunk$set(comment = "")
report_code_event <- function(tutorial_id, tutorial_version, user_id, event, data) {
  if (is.null(data$code)) return()
  rlang::inform(sprintf("---- %s ----\n%s", event, capture.output(dput(data$code))))
}
options(tutorial.event_recorder = report_code_event)

Test Cases

https://github.com/rstudio/learnr/issues/691

Hint

Reveal the hint, copy and paste into the exercise, and run.


c(
  1,
  2,
  3
)

Expected output:

::: {#ex1-expected-output}


:::

Solution

Reveal the solution, copy and paste into the exercise, and run.


c(
  "apple",
  "banana",
  "coconut"
)

Expected output:

::: {#ex2-expected-output}


:::



Try the learnr package in your browser

Any scripts or data that you put into this service are public.

learnr documentation built on Sept. 28, 2023, 9:06 a.m.