view: Explore and Render Exam Exercises

viewR Documentation

Explore and Render Exam Exercises

Description

This function allows the user to explore exercises from the exams.forge.data package and optionally render them to PDF or HTML. Users can filter exercises by directory (topic) or by a pattern in filenames or file contents.

Usage

view(
  action = c("topic", "file", "pdf", "html"),
  pattern = NULL,
  topic = TRUE,
  ...
)

Arguments

action

Character. One of "topic", "file", "pdf", or "html".

  • "topic": return the list of available exercise topics (subdirectories).

  • "file": return the list of exercise filenames relative to ⁠aufgaben/⁠.

  • "pdf": render selected exercises to PDF.

  • "html": render selected exercises to HTML.

pattern

Character or NULL. A regular expression to filter exercises. If topic = TRUE, the pattern is matched against the directory names (topics). If topic = FALSE, the pattern is searched inside the exercise files.

topic

Logical. If TRUE (default), pattern is applied to directory names. If FALSE, pattern is applied to the content of the exercise files.

...

Additional arguments passed to grepl() when filtering files or contents.

Value

A character vector of topics or filenames, or NULL if no exercises are found. When rendering (pdf/html), the files are rendered silently with messages and warnings suppressed.

Examples


view("topic")

# List all files in a specific topic
view("file", pattern = "ttest", topic = TRUE)

if (interactive()) {
# Render the files matching a pattern to HTML
  view("file", pattern = "hyper")
  view("html", pattern = "hyper")
}



exams.forge.data documentation built on Sept. 11, 2025, 9:09 a.m.