# load sample data
data(efc)
# retrieve value and variable labels
variables <- get_var_labels(efc)
values <- get_val_labels(efc)
# show frequencies of "e42dep" in RStudio Viewer Pane
# or default web browser
sjt.frq(efc$e42dep)
# plot and show frequency table of "e42dep" with labels
sjt.frq(efc$e42dep,
variableLabels=variables['e42dep'],
valueLabels=values[['e42dep']])
# plot frequencies of e42dep, e16sex and c172code in one HTML file
# and show table in RStudio Viewer Pane or default web browser
sjt.frq(as.data.frame(cbind(efc$e42dep, efc$e16sex, efc$c172code)),
variableLabels=list(variables['e42dep'], variables['e16sex'], variables['c172code']),
valueLabels=list(values[['e42dep']], values[['e16sex']], values[['c172code']]))
# plot larger scale including zero-counts
# indicating median and quartiles
sjt.frq(efc$neg_c_7,
variableLabels=variables['neg_c_7'],
valueLabels=values[['neg_c_7']],
highlightMedian=TRUE,
highlightQuartiles=TRUE)
# -------------------------------
# auto-detection of labels
# -------------------------------
efc <- set_var_labels(efc, variables)
sjt.frq(data.frame(efc$e42dep, efc$e16sex, efc$c172code))
# -------------------------------
# sort frequencies
# -------------------------------
sjt.frq(efc$e42dep, sort.frq="desc")
# --------------------------------
# User defined style sheet
# --------------------------------
sjt.frq(efc$e42dep,
variableLabels=variables['e42dep'],
valueLabels=values[['e42dep']],
CSS=list(css.table="border: 2px solid;",
css.tdata="border: 1px solid;",
css.firsttablecol="color:#003399; font-weight:bold;"))
Run the code above in your browser using DataLab