rk.ctables: Custom Tables for RKWard
Features
-
Stacking (Rows): Select multiple variables to stack them vertically (e.g., creating a demographic profile section).
-
Nesting (Columns): Select multiple grouping variables to create hierarchical headers (e.g., Gender > Age Group).
-
Weighting: Built-in support for survey weights (
tab_weight).
-
Statistics: Easily toggle Counts, Column Percentages, and Row Percentages.
-
Total Control: Configure the label and position (Top/Bottom/None) of Total rows/columns.
-
Output: Generates formatted HTML tables directly in the RKWard output window.
π Internationalization
The interface is fully localized to match your RKWard language settings:
- πΊπΈ English (Default)
- πͺπΈ Spanish (
es)
- π«π· French (
fr)
- π©πͺ German (
de)
- π§π· Portuguese (Brazil) (
pt_BR)
Requirements
-
RKWard: 0.7.5 or higher.
-
R Packages:
expss
-
magrittr (for piping %>%)
Installation
- Open R in RKWard.
- Run the following commands in the R console:
local({
require(devtools)
install_github(
repo="AlfCano/rk.ctables"
)
rk.header ("Resultados de Instalar desde git")
})
- Restart RKWard to ensure the new menu items appear correctly.
Usage & Examples
The plugin relies on Variable Labels to produce professional tables (just like SPSS). Without labels, the table will show raw variable names (e.g., sex) instead of "Gender".
Step 0: Prepare Data (Penguins)
Copy and run this code in your RKWard console to load the penguins dataset and apply labels:
data("penguins")
library(expss)
penguins = apply_labels(penguins,
species = "Penguin Species",
island = "Island Location",
bill_length_mm = "Bill Length (mm)",
sex = "Gender",
year = "Study Year"
)
Example 1: Basic Stacking (Demographics Table)
Create a summary table showing multiple variables stacked vertically.
- Navigate to Analysis > Custom Tables (expss) > Custom Table Builder.
-
Rows (Stacked): Select
species AND island.
-
Columns: Leave empty (defaults to Total).
-
Statistics: Check Counts (Cases) and Column Percent %.
- Click Submit.
-
Result: A vertical table showing the distribution of Species, followed immediately by the distribution of Islands.
Example 2: Simple Crosstab
Compare groups side-by-side.
-
Rows: Select
species.
-
Columns: Select
sex.
-
Statistics: Check Column Percent %.
- Click Submit.
-
Result: A standard crosstab showing Species distribution broken down by Gender.
Example 3: Complex Nesting (Hierarchical Columns)
Create a highly detailed table by nesting grouping variables.
-
Rows: Select
species.
-
Columns: Select
sex AND year.
-
Statistics: Check Counts and Column Percent %.
-
Total Position: Select After (Right/Bottom).
- Click Submit.
-
Result: A wide table where "Male" and "Female" are the main headers, and each gender is further subdivided by "2007", "2008", and "2009".
Author
Alfonso Cano Robles
Assisted by Gemini, a large language model from Google.