rk.svyplot: Base Graphics for Survey Data

An RKWard plugin package that provides a graphical interface for the native plotting functions of the survey package. Unlike other plugins that use ggplot2, this package focuses on Base R graphics, offering specialized visualizations for complex survey designs (weighted data) that are lightweight and statistically rigorous.

It allows users to create survey-weighted plots—which are often more representative than standard plots—without writing R code.

What's New in Version 0.0.2

This version focuses on accessibility and internationalization. The entire plugin suite has been fully localized.

Features

The plugin provides a suite of tools organized under the Survey -> Graphs -> Survey plots menu in RKWard.

1. Survey Scatterplot (svyplot)

The main plugin. Creates survey-weighted scatterplots with several styles to visualize weights and density:

2. Bar Plot (barplot.svystat)

Creates a bar plot directly from a svytable object (produced by the rk.survey.design or rk.questionr plugins).

3. Conditioned Scatterplot (svycoplot)

Creates faceted scatterplots (Trellis plots) to examine relationships conditioned on the levels of a third variable.

4. Survey Q-Q Plot (svyqqplot)

Produces quantile-quantile plots to compare the distribution of a survey variable against a theoretical distribution.

5. Survey Histogram & Boxplot

A versatile component to visualize distributions.

6. Smoothed Scatterplot (svysmooth)

Creates a scatterplot with a smoothed conditional mean line (using LOESS or GAM) to visualize trends in survey data.

General Features

Installation

  1. Prerequisite: Ensure you have the remotes package installed in R.

  2. Install: Run the following command in the RKWard R Console:

    # If you don't have devtools/remotes installed:
    # install.packages("remotes")
    
    local({
      require(remotes)
      install_github("AlfCano/rk.svyplot", force = TRUE)
    })
    
  3. Restart: Restart RKWard to load the new menu entries and translations.

Usage Example: Creating a Conditioned Scatterplot

This example demonstrates how to create a faceted scatterplot to examine the relationship between two variables across different school types.

1. Prepare Sample Data First, load the survey library and create a svydesign object. Run this code in the RKWard console:

library(survey)
data(api)

# Create a survey design object
dclus1 <- svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)

You will now have a survey design object named dclus1 in your workspace.

2. Open the Plugin Go to the RKWard menu: Survey -> Graphs -> Survey plots -> Conditioned Scatterplot.

3. Configure the Dialog

4. Preview the Result Click the Preview button. A plot will appear in the dialog, showing the relationship between api00 and api99 in three separate panels: one for Elementary, one for Middle, and one for High Schools.

5. Submit Click the Submit button. A new plot device window will open in RKWard displaying the final, high-quality graph.

Dependencies

This plugin requires the following R packages:

Author & License