exams.forge.data

Sum of Squares Dataset

The package contains the precomputed dataset sos100, which holds integer solutions for:

  1. \(\sum_{i=1}^{k} x_i = 0\)
  2. \(\sum_{i=1}^{k} x_i^2 = 100\)

This dataset can be used as a basis for Pearson correlation, linear regression, or other computations requiring integer data with exact sums of squares.

data("sos100")
str(sos100)
#>  num [1:381, 1:10] -3 -5 -4 -5 -3 -4 -3 -3 -3 -4 ...
#>  - attr(*, "full")= logi TRUE
# sum_i x_i
head(rowSums(sos100, na.rm=TRUE))
#> [1] 0 0 0 0 0 0
# sum_i x_i^2
head(rowSums(sos100^2, na.rm=TRUE))
#> [1] 100 100 100 100 100 100
# number of non-missing observations
head(rowSums(!is.na(sos100)))
#> [1] 6 4 6 6 7 7

Using sos() for other datasets

For other values of n or different maximum number of summands (nmax), use the sos() function from the exams.forge package:

library("exams.forge")
# Retrieve or compute the dataset for n = 200
sos200 <- sos(200)
# With a custom nmax
sos_custom <- sos(150, nmax = 12)

This function will attempt to load the dataset from the package, a cached location, GitHub, or compute it on the fly if necessary.

List of Available Exercises

Note:

  • All exercises are written in German, and not all have appeared on exams.
  • Some exercises require additional R packages.
  • Certain exercises use the same calculation methods but in different contexts.
  • The quality of the exercises may vary; some challenges only become apparent during an exam.

Exercises:

Total exercises: approx. 546

Exploring Exercises with view()

The view() function is designed to help users explore and render exercises included in the exams.forge.data package. It provides a fully scriptable interface for browsing topics, listing exercises, and optionally rendering them to PDF or HTML, without relying on interactive menus.

Key Features

  1. List available topics
head(view("topic"))
#> [1] "bivariat/kendall"         "bivariat/kontingenz"     
#> [3] "bivariat/kovarianz"       "bivariat/pearson"        
#> [5] "bivariat/spearman"        "bivariat/unabhaengigkeit"

Returns a character vector of all exercise topics (i.e., subdirectories under aufgaben/). This helps users understand the structure of the exercises and pick a topic of interest.

  1. List exercises in a topic or matching a pattern
head(view("file", pattern = "ttest"))
#> [1] "test/ttest_entscheidung_schoice/artischocken_duenger.Rmd"
#> [2] "test/ttest_entscheidung_schoice/einkommen_waehler.Rmd"   
#> [3] "test/ttest_entscheidung_schoice/filialeroeffnung.Rmd"    
#> [4] "test/ttest_entscheidung_schoice/iq.Rmd"                  
#> [5] "test/ttest_entscheidung_schoice/maeuse_gewicht.Rmd"      
#> [6] "test/ttest_entscheidung_schoice/tabaksteuer.Rmd"

Returns exercise filenames relative to the subdirectory aufgaben/ in the package.

  • pattern can filter by directory names (topics) or, if topic = FALSE, by content inside exercises.
  • This allows you to quickly locate exercises relevant to a specific concept or statistical test.
  1. Render exercises to HTML
view("html", pattern = "hyper")

Uses exams2html() to render the selected exercises. Output is silently generated, suppressing messages and warnings.

  1. Render exercises to PDF
view("pdf", pattern = "ttest")

Uses exams2pdf() to render the selected exercises to PDF. A plain LaTeX template is applied, and messages/warnings are suppressed to avoid console clutter.

Parameters

  • action: "topic", "file", "pdf", or "html". Determines what the function returns or does.
  • pattern: Optional regular expression to filter files or topics.
  • topic: Logical; if TRUE (default), pattern is applied to topic (directory) names; if FALSE, pattern is applied to file contents.
  • ...: Additional arguments passed to grepl() for filtering.

Workflow Example

# 1. List all topics
topics <- view("topic")

# 2. Select exercises from a specific topic
files <- view("file", pattern = "ttest", topic = TRUE)

# 3. Render them to HTML
view("html", pattern = "ttest")

This approach allows users to explore hundreds of exercises efficiently, filter by topic or content, and generate outputs in multiple formats without manual interaction.