Learn R Programming

exceldata (version 0.1.1.3)

plotVariables: Return a list of univariate ggplots for each non-character variable

Description

This function should be run as the final step after the data have been imported, checked and the factor variables created.

Usage

plotVariables(data, dictionary, IDvar, vars, showOutliers = TRUE)

Value

A list of plots with one plot for each variable

Arguments

data

A data frame containing the variables to be plotted

dictionary

Optional, the data dictionary returned by importExcelData or readDataDict functions to provide plot titles

IDvar

Optional string indicating the name of an identifying variable to highlight outliers

vars

Optional, vector of the names of variables to plot

showOutliers

Boolean, Defaults to TRUE. Should outliers be labelled? Outliers are defined by the 1.5xIQR rule (as with boxplots)

Examples

Run this code
if (FALSE) {
exampleDataFile <- system.file("extdata", "exampleData.xlsx", package = "exceldata")
import <- importExcelData(exampleDataFile,
dictionarySheet = 'DataDictionary',dataSheet = 'DataEntry')
dictionary <- import$dictionary
data <- import$data

# Simple univariate plots with outliers
plots <- plotVariables(data=data,dictionary=dictionary,IDvar = 'ID')
plots
}

Run the code above in your browser using DataLab