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.
This version focuses on accessibility and internationalization. The entire plugin suite has been fully localized.
es)fr)de)pt_BR)The plugin provides a suite of tools organized under the Survey -> Graphs -> Survey plots menu in RKWard.
svyplot)The main plugin. Creates survey-weighted scatterplots with several styles to visualize weights and density:
hcl.colors.barplot.svystat)Creates a bar plot directly from a svytable object (produced by the rk.survey.design or rk.questionr plugins).
svycoplot)Creates faceted scatterplots (Trellis plots) to examine relationships conditioned on the levels of a third variable.
svyqqplot)Produces quantile-quantile plots to compare the distribution of a survey variable against a theoretical distribution.
A versatile component to visualize distributions.
svyhist): Weighted histogram with adjustable bin counts/breaks.svyboxplot): Weighted boxplots, optionally grouped by a factor variable.svysmooth)Creates a scatterplot with a smoothed conditional mean line (using LOESS or GAM) to visualize trends in survey data.
NA) in the selected variables before plotting.Prerequisite: Ensure you have the remotes package installed in R.
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)
})
Restart: Restart RKWard to load the new menu entries and translations.
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
dclus1.api00 (API score in 2000).api99 (API score in 1999).stype (School Type). This variable will create the panels.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.
This plugin requires the following R packages:
surveyhexbin (for hexagonal binning styles)RColorBrewerKernSmooth (for smoothing)