| Title: | Making Visual Exploratory Data Analysis with Nested Data Easier |
|---|---|
| Description: | Provides tools for visual exploratory data analysis with nested data. Includes functions for creating bivariate plots, dot plots, histograms, and violin plots for each group or unit in nested data. Methods are described in Crabtree and Nelson (2017) "Plotrr: Functions for making visual exploratory data analysis with nested data easier" <doi:10.21105/joss.00190>. |
| Authors: | Charles Crabtree [aut, cre], Michael J. Nelson [aut] |
| Maintainer: | Charles Crabtree <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.2 |
| Built: | 2026-10-01 14:26:41 UTC |
| Source: | https://github.com/lobsterbush/plotrr |
Draws a scatterplot with a smooth curve for each group. Use it to see how the relationship varies across groups.
bivarplots(x, y, group, data)bivarplots(x, y, group, data)
x |
The name of the x column, as a string. |
y |
The name of the y column, as a string. |
group |
The name of the grouping column, as a string. |
data |
A data frame. |
Prints one plot per group. The function returns NULL invisibly.
Charles Crabtree [email protected]
a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) bivarplots("a", "b", "c", data)a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) bivarplots("a", "b", "c", data)
Draws a scatterplot and adds marks along each axis at the observed values.
bivarrugplot(x, y, data)bivarrugplot(x, y, data)
x |
The name of the x column, as a string. |
y |
The name of the y column, as a string. |
data |
A data frame. |
Prints the plot and returns the ggplot object invisibly.
Charles Crabtree [email protected]
a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) data <- data.frame(a, b) bivarrugplot("a", "b", data)a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) data <- data.frame(a, b) bivarrugplot("a", "b", data)
Prints a form-feed character. Whether this clears the display depends on your console.
clear(...)clear(...)
... |
An unused argument. |
No return value (called for side effect of printing a form feed
character to the console, which visually clears the R terminal). Returns
NULL invisibly.
Charles Crabtree [email protected]
clear()clear()
Draws the distribution of x separately for each group.
dotplots(x, y, group, data, n)dotplots(x, y, group, data, n)
x |
The name of the x column, as a string. |
y |
Kept for compatibility; this function doesn't use it. |
group |
The name of the grouping column, as a string. |
data |
A data frame. |
n |
Sets the bin width to 1/n. Try a few values to find a useful level of detail. |
Prints one dot plot per group. The function returns NULL invisibly.
Charles Crabtree [email protected]
a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) dotplots("a", "b", "c", data, 20)a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) dotplots("a", "b", "c", data, 20)
Draws the distribution of x separately for each group.
histplots(x, y, group, data, n)histplots(x, y, group, data, n)
x |
The name of the x column, as a string. |
y |
Kept for compatibility; this function doesn't use it. |
group |
The name of the grouping column, as a string. |
data |
A data frame. |
n |
The number of bins. |
Prints one histogram per group. The function returns NULL invisibly.
Charles Crabtree [email protected]
a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) histplots("a", "b", "c", data, 5)a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) histplots("a", "b", "c", data, 5)
Count distinct non-missing values.
lengthunique(x)lengthunique(x)
x |
A vector. |
The number of distinct values after removing missing values.
Charles Crabtree [email protected]
x <- rep(c(1:10), 10) lengthunique(x)x <- rep(c(1:10), 10) lengthunique(x)
Convert numeric factor labels to numbers.
makefacnum(x)makefacnum(x)
x |
A vector. |
A numeric vector.
Charles Crabtree [email protected]
x <- c("1", "2", "3") x <- as.factor(x) x x <- makefacnum(x) x is.numeric(x)x <- c("1", "2", "3") x <- as.factor(x) x x <- makefacnum(x) x is.numeric(x)
Draws the distribution of y across values of x, separately for each group.
violinplots(x, y, group, data)violinplots(x, y, group, data)
x |
The name of the x column, as a string. |
y |
The name of the y column, as a string. |
group |
The name of the grouping column, as a string. |
data |
A data frame. |
Prints one plot per group. The function returns NULL invisibly.
Charles Crabtree [email protected]
a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) violinplots("a", "b", "c", data)a <- runif(1000, min = 0, max = 1) b <- a + rnorm(1000, mean = 0, sd = 1) c <- rep(c(1:10), times = 100) data <- data.frame(a, b, c) violinplots("a", "b", "c", data)