DialogR

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.

← Return to the illustrated manual

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.

PackageFunctions used by the dialogs
admisc ≥ 0.41using(), inside(), recode()
declared ≥ 0.27wtable(), wsummary(), wquantile(), wmeasures(), and individual weighted summaries
DDIwR ≥ 0.20convert() for statistical data and Excel imports
statistics > 0.14t.testhv(), anovahv()
base / stats (with R)subset(), order(), readRDS(), t.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 > 45

Use == 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.

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.

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.

Screenshot