The package contains the precomputed dataset sos100,
which holds integer solutions for:
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 7sos() for other datasetsFor 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.
Note:
Exercises:
Total exercises: approx. 546
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.
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.
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.Uses exams2html() to render the selected exercises.
Output is silently generated, suppressing messages and warnings.
Uses exams2pdf() to render the selected exercises to
PDF. A plain LaTeX template is applied, and messages/warnings are
suppressed to avoid console clutter.
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.# 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.