rk.codebook generates professional HTML data dictionaries directly within RKWard. It bridges the gap between RKWard's internal variable labels and standard R reporting tools (powered by sjPlot), allowing you to create instant "Codebooks" for your datasets.
rk.set.label) and applies them to the report.The interface is fully localized to match your RKWard language settings:
es)fr)de)pt_BR)sjPlot.
install.packages("sjPlot")
devtools (for installation from source).local({
## Preparar
require(devtools)
## Computar
install_github(
repo="AlfCano/rk.codebook"
)
## Imprimir el resultado
rk.header ("Resultados de Instalar desde git")
})
To generate a useful codebook, your data needs metadata (Labels). You can add these via the RKWard Data Editor GUI, or programmatically using rk.set.label.
Run this code in the RKWard console to create a dataset and assign RKWard-native labels:
# 1. Create a raw dataset
my_survey <- data.frame(
id = 1:10,
age = c(25, 30, 22, NA, 45, 28, 33, 40, 29, 31),
group = factor(c(1, 1, 2, 2, 1, 2, 1, 2, 1, 1), labels = c("Control", "Treatment")),
satisfaction = c(4, 5, 3, 4, NA, 5, 4, 2, 3, 5)
)
# 2. Apply Variable Labels using RKWard's native function
# This is what the plugin "Sync" feature looks for.
rk.set.label(my_survey$id, "Participant Unique Identifier")
rk.set.label(my_survey$age, "Age of Respondent (Years)")
rk.set.label(my_survey$group, "Experimental Condition")
rk.set.label(my_survey$satisfaction, "Self-reported Satisfaction (1-5)")
# 3. (Optional) Check that labels are applied
# rk.get.label(my_survey$age)

Screenshot of the path in the main menu.
my_survey.group variable).
Screenshot of the RKWard interface showing the main panel of rk.codebook and the selection of variables for dictionary generation.
The Output Window will display a formatted HTML table where:
rk.set.label.NA in Age and Satisfaction.
Screenshot of the HTML output device showing the resulting Codebook, with frequency tables and summary statistics.
Alfonso Cano Robles
Assisted by Gemini, a large language model from Google.