rk.janitor: Data Cleaning Tools for RKWard

This package provides a suite of RKWard plugins that create a graphical user interface for the janitor R package. It implements a "Inspect -> Clean -> Validate" workflow, allowing users to sanitize dataframes, manage duplicates, and create publication-ready frequency tables without writing code.

Features / Included Plugins

This package installs a new submenu in RKWard: Data > Data Cleaning (janitor), which contains the following plugins:

🌍 Internationalization

As of version 0.0.2, the interface is fully localized to match your RKWard language settings:

Requirements

  1. A working installation of RKWard.
  2. The R packages janitor and dplyr.
    install.packages(c("janitor", "dplyr"))
    
  3. The R package devtools (for installation from source).

Installation

  1. Open R in RKWard.
  2. Run the following commands in the R console:
local({
## Preparar
require(devtools)
## Computar
  install_github(
    repo="AlfCano/rk.janitor"
  )
## Imprimir el resultado
rk.header ("Resultados de Instalar desde git")
})
  1. Restart RKWard to ensure the new menu items appear correctly.

Usage & Examples

To try the examples below, you will need the penguins dataset (included in R 4.5.2+ or the palmerpenguins package) and a custom "messy" dataset.

Step 0: Prepare Data

Run this code in the RKWard console to create a dataset with errors:

# A dataset with duplicates, empty rows, and constant columns
messy_sales <- data.frame(
  id = c(101, 102, 103, 101, NA),
  product = c("Apple", "Banana", "Orange", "Apple", NA),
  amount = c(10, 20, 15, 10, NA),
  status = c("Active", "Active", "Active", "Active", NA) # Constant column
)

# Load penguins if not already loaded
data("penguins") # or library(palmerpenguins)

Example 1: Sanitize Data

  1. Navigate to Data > Data Cleaning (janitor) > Sanitize Data.
  2. Select messy_sales.
  3. Check Remove empty rows, Remove empty columns, and Remove constant columns.
  4. Click Submit.
    • Result: The row of NAs is gone, and the status column (which contained only "Active" and NA) is removed.

Example 2: Manage Duplicates

  1. Navigate to Data > Data Cleaning (janitor) > Manage Duplicates.
  2. Select messy_sales.
  3. Action: Select "Find Duplicates".
  4. Variables to check: Select id and product.
  5. Click Submit.
    • Result: It identifies that ID 101 (Apple) appears twice.

Example 3: Frequency Tables (tabyl)

  1. Navigate to Data > Data Cleaning (janitor) > Frequency Tables (tabyl).
  2. Row Variable: Select species (from penguins).
  3. Column Variable: Select island.
  4. Adornments: Check Show Totals, Show Percentages, and Format Percentages.
  5. Click Submit.
    • Result: A neat crosstab showing the percentage breakdown of penguin species across islands, formatted as percentages (e.g., "30.5%") with totals.

Author

Alfonso Cano Robles (alfonso.cano@correo.buap.mx)

Assisted by Gemini, a large language model from Google.