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 7
sos()
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") # version 1.0.12 is required
# 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:
on Github you can find an overview of all exercises included in the package, organized by topic (directory).
Topic | Exercises |
---|---|
bivariat/kendall | 6 |
bivariat/kontingenz | 7 |
bivariat/kovarianz | 2 |
bivariat/pearson | 7 |
bivariat/spearman | 7 |
bivariat/unabhaengigkeit | 4 |
bivariat/varianz_summe | 1 |
indices | 3 |
konfidenzintervall/anteilswert_stichprobenumfang | 1 |
konfidenzintervall/mittelwert_grenze | 10 |
konfidenzintervall/mittelwert_laenge | 2 |
konfidenzintervall/mittelwert_stichprobenumfang | 10 |
regression/bestimmtheitsmass | 11 |
regression/koeffizient | 15 |
regression/korrelation | 2 |
regression/prognose | 2 |
regression/vergleich | 1 |
regressionsmodell | 2 |
schaetzen/kq_differenz | 3 |
schaetzen/kq_parameter | 3 |
schaetzen/mittelwert_erwartungstreu | 7 |
schaetzen/ml_differenz | 4 |
schaetzen/ml_parameter | 11 |
schaetzen/modell_erwartungswert | 2 |
schaetzen/varianz_erwartungstreu | 6 |
stichproben/anteilswert_wahrscheinlichkeit | 6 |
stichproben/mittelwert_schwankungsintervall | 6 |
test/anpassungstest_pruefwert | 3 |
test/ptest_alphaexakt | 2 |
test/ptest_entscheidung_schoice | 7 |
test/ptest_hypothesen_schoice | 10 |
test/ptest_kritische_werte | 7 |
test/ptest_pruefwert | 7 |
test/ptest_stichprobenfunktion | 7 |
test/t2test_pruefwert | 4 |
test/test_hypothesen_schoice | 6 |
test/ttest_entscheidung_schoice | 7 |
test/ttest_hypothesen_schoice | 7 |
test/ttest_kritische_werte | 4 |
test/ttest_pruefwert | 7 |
test/ttest_stichprobenfunktion | 7 |
test/unabhaengigkeitstest_freiheitsgrade | 1 |
univariat/amittel | 5 |
univariat/amittel_klassiert | 15 |
univariat/eigenschaft | 3 |
univariat/haeufigkeiten | 5 |
univariat/haeufigkeiten_klassiert | 4 |
univariat/hmittel | 16 |
univariat/median | 7 |
univariat/median_klassiert | 7 |
univariat/modus | 2 |
univariat/modus_klassiert | 6 |
univariat/quantil | 4 |
univariat/quartilsdispersion | 1 |
univariat/varianz | 2 |
univariat/varianz_summe | 1 |
univariat/variationskoeff | 1 |
verteilung/approx | 5 |
verteilung/binomial | 16 |
verteilung/diskrete_gleich | 9 |
verteilung/exponential | 15 |
verteilung/hypergeometrisch | 17 |
verteilung/normal | 27 |
verteilung/poisson | 13 |
verteilung/stetige_gleich | 8 |
verteilung/zgs_erwartungswert | 1 |
verteilung/zgs_varianz | 1 |
verteilung/zgs_wahrscheinlichkeit | 2 |
wahrscheinlichkeit/bayes | 8 |
wahrscheinlichkeit/bedingte_wk | 9 |
wahrscheinlichkeit/grundbegriffe | 2 |
wahrscheinlichkeit/kombination | 11 |
wahrscheinlichkeit/kombination_wdh | 1 |
wahrscheinlichkeit/laplace | 12 |
wahrscheinlichkeit/mises | 1 |
wahrscheinlichkeit/multiplikation | 2 |
wahrscheinlichkeit/permutation | 4 |
wahrscheinlichkeit/totalwk | 11 |
wahrscheinlichkeit/unabhaengigkeit | 2 |
wahrscheinlichkeit/variation | 5 |
wahrscheinlichkeit/variation_wdh | 2 |
zeitreihe/gmittel | 1 |
zeitreihe/guete | 2 |
zeitreihe/movingaverage | 2 |
zeitreihe/prognose | 3 |
zeitreihe/season_add | 2 |
zeitreihe/season_mul | 1 |
zeitreihe/trend_lin | 1 |
zufallsvariable/diskret_erwartungswert | 11 |
zufallsvariable/diskret_varianz | 7 |
zufallsvariable/diskret_wahrscheinlichkeit | 6 |
zufallsvariable/korrelation | 1 |
zufallsvariable/stetig_erwartungswert | 4 |
zufallsvariable/stetig_varianz | 4 |
zufallsvariable/stetig_wahrscheinlichkeit | 7 |
zufallsvariable/stetig_wahrscheinlichkeit_bedingt | 2 |
zufallsvariable/verteilungsfunktion | 1 |
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.view("html", pattern = "hyper")
Uses exams2html()
to render the selected exercises.
Output is silently generated, suppressing messages and warnings.
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.
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.
To render all exercises (on my computer, this takes roughly 1 minute), use the following code:
library("exams.forge")
files <- list.files(path=system.file("aufgaben", package="exams.forge.data"),
pattern="\\.Rmd$", recursive = TRUE, full.names = TRUE)
# Render all 500+ exercises
exams2html(files)
# Render all exercises as PDF using a custom LaTeX template
# (required because 'exams' does not support \usepackage[xtable]{xcolor})
exams2pdf(files, template=system.file("aufgaben", "plain.tex", package="exams.forge.data"))
Notes:
In search_files(file, dir = dir, recursive = recursive) :
The following files are found more than once, first match used: ...
LaTeX Warning: 'h' float specifier changed to 'ht'.
These warnings are generally harmless and can be safely ignored.