Optional background
Behind the dialogs.
DialogR writes these commands from your selections. This reference is here when you want to inspect, save, or adapt them.
The structure of a command
This is the political-interest example from the manual:
using(
ess,
wtable(B1_polintr, vlabel = TRUE)
)admisc’s using() evaluates the analysis within ess, so the function can refer to columns by their names. declared’s wtable() uses the variable’s labels and missing-value metadata. The vlabel argument requests its descriptive label.
Named arguments control options. TRUE and FALSE are logical values; quoted text is a string. A formula such as F3_agea ~ F2_gndr puts the response on the left and the grouping variable on the right. Commands generally omit options that match a function’s defaults.
Packages and functions
Desktop DialogR is a graphical layer on top of R: install R first, then install the packages through the Packages menu. The application uses CRAN and development repositories. Packages must be available in the R installation selected by DialogR. WebR supplies its own browser-compatible R runtime and library.
| Package | Functions used by the dialogs |
|---|---|
| admisc ≥ 0.41.1 | using(), inside(), recode(), addCases() |
| declared ≥ 0.27 | wtable(), wsummary(), wquantile(), wmeasures(), and individual weighted summaries |
| DDIwR ≥ 0.20 | convert() for statistical data and Excel imports |
| statistics > 0.14 | t.testhv(), anovahv() |
| base / stats (with R) | subset(), order(), readRDS(), merge(), cbind(), t.test(), cor.test(), proportions(), chisq.test(), pairwise.t.test() |
The desktop setup also needs httpgd, jsonlite, askpass, later, and digest. Excel import uses readxl. If it is missing, install it in the active R library:
install.packages("readxl")When reusing dialog commands in a fresh R session, load the required packages and dataset first:
library(admisc)
library(declared)
library(DDIwR)
library(statistics)
ess <- readRDS(file.choose())For individual function documentation, use the R help system, for example help("wtable", package = "declared").
Why the declared class matters
The teaching file already stores the analysis variables as declared. Their labels and na_values definitions remain attached to the variables. Do not coerce them to ordinary factors or numeric vectors merely to reproduce the screenshots: that changes the data contract the examples demonstrate.
For B1_polintr, values 1–4 are substantive responses and 7, 8, 9 are declared missing. The missing categories keep distinct labels even though valid numerical calculations exclude them. B7_trstlgl instead has valid values 0–10 and declared missing codes 77, 88, 99.
Selection expressions
The subset dialog accepts a condition. Declared variables support comparisons using their value labels:
F2_gndr == "Female"
F3_agea >= 45
F2_gndr == "Female" & F3_agea > 45Use == for equality, != for inequality, & for “and”, and | for “or”. Conditions evaluating to missing do not select a case. The dialog builds the surrounding subset call and assignment:
essf <- subset(ess, F2_gndr == "Female")Filters, grouping, and weights
using(
subset(ess, F2_gndr == "Female"),
wtable(B1_polintr, wt = fweight, vlabel = TRUE)
)
using(ess, wtable(B1_polintr), split.by = F2_gndr)The support table in the manual states which dialogs use each setting. Dataset state is not a global promise that every R function will be weighted or split.
Assignments and recoding
inside(
ess,
agerec <- recode(F3_agea, rules = "lo:44=1; 45:hi=2")
)The assignment arrow names a result; inside() updates the named dataset. Semicolons separate recoding rules. Check the result’s labels and missing definitions after a transformation. Recoding and sorting use the underlying dataset rather than the filtered analysis view.
Combining datasets
The merge examples use the downloadable respondents, later, regions, and notes CSV files. Add cases uses admisc’s addCases():
survey_all <- addCases(respondents, later, keep = "all")Rows from the first source precede those from the second. The keep argument selects common variables by default; "all" keeps their union, "x" keeps the first source’s variables, and "y" keeps the second’s. add.x and add.y can add selected unpaired variables, while exclude leaves variables out. The dialog chooses a compact command for the requested selection.
The lookup example uses base R’s merge(). Only the selected keys are named in by. Exclusions subset the appropriate source, and the uniqueness check stops a lookup with repeated keys before assignment:
stopifnot(!anyDuplicated(regions["region"]))
survey_named <- merge(
respondents,
regions[setdiff(names(regions), "internal_note")],
by = "region",
all.x = TRUE
)Lookup 2 adds all.x = TRUE; Lookup 1 adds all.y = TRUE. With neither selected, merge() retains only matches. Its default sorts by the keys and adds .x/.y suffixes to shared non-key names. See the base R merge documentation for the matching rules.
By row order pads both inputs to their maximum row count before cbind(). The generated command avoids recycling a shorter input:
survey_notes <- cbind(
respondents[seq_len(max(nrow(respondents), nrow(notes))), , drop = FALSE],
notes[seq_len(max(nrow(respondents), nrow(notes))), , drop = FALSE]
)A new-dataset name appears on the left of the assignment. Without that option, the result is assigned to Dataset 1. Active source filters appear as subset() expressions in the generated command; grouping and frequency weighting are not applied.
Summary commands
using(ess, wsummary(B7_trstlgl))
using(ess, wmeasures(B7_trstlgl, what = c("mean", "sd")))A single measure uses its own function; several use wmeasures(). With multiple selected variables the dialog subsets the columns and uses a dot to represent that selection. If this excludes a grouping or weight column needed by the analysis, use individual-variable analyses or adapt a script to retain those columns. The standalone range() call is not weighted.
Bivariate correlation
using(ess, cor.test(F3_agea, B7_trstlgl))
using(ess, cor.test(F3_agea, B7_trstlgl, method = "spearman", alternative = "greater"))The dialog tests one pair of numeric variables using stats::cor.test(). Pearson and a two-sided alternative are the defaults. Spearman and Kendall use ranks. Cases missing either variable are excluded together. A non-default Pearson confidence level adds conf.level, such as 0.99 for 99%. Rank methods do not return a confidence interval. Active filters apply; grouping and frequency weighting do not.
Tests and multiple results
using(ess, t.test(F3_agea, alternative = "two.sided", mu = 50, conf.level = 0.95))
using(ess, t.testhv(F3_agea ~ F2_gndr))
using(ess, {
print(anovahv(F3_agea ~ F14_domicil, numsum = TRUE))
pairwise.t.test(F3_agea, F14_domicil, p.adjust.method = "bonferroni")
})Braces group statements. print() displays an intermediate result before the next statement runs. The pairwise call uses its own defaults; it does not inherit the ANOVA variance or confidence settings. These unweighted teaching examples do not establish a complete complex-survey analysis.
Current exact-test limitation
The contingency dialog currently emits fischer.exact(), which is not the standard R function. The ordinary R alternative is stats::fisher.test() applied to a suitable count table:
using(ess, {
.table <- wtable(B1_polintr, F2_gndr)
stats::fisher.test(.table)
})Check the table, test assumptions, and computation requirements before using this alternative.
Optional Excel metadata sheets
DDIwR reads the first sheet as data. Supply both a variables sheet and a values sheet (also accepted as codes) to use the metadata route. The variables sheet matches name to label. The values sheet has variable, value (or code), label, and missing columns; y marks a declared missing value. Names must match the data sheet. The import dialog does not expose a sheet selector.