## using tinyplot() with data frames
tinyplot(cars)
tinyplot(iris, Sepal.Length ~ Petal.Width | Species)
tinyplot(
as.data.frame(UCBAdmissions),
Admit ~ Gender, facet = 1 ~ Dept, weights = Freq
)
## note that this also enables usage with pipes (in R >= 4.1.0) such as
# cars |> tinyplot()
# iris |> tinyplot(Sepal.Length ~ Petal.Width | Species)
# UCBAdmissions |>
# as.data.frame() |>
# tinyplot(Admit ~ Gender, facet = 1 ~ Dept, weights = Freq)
# etc.
## pairs-style display for data frames with 3 or more variables
## (works best with a theme)
tinytheme("clean2")
tinyplot(iris)
## pass `by` arg to group the pairs display (legend is suppressed)
## here, we also add optional frames around the individual sub-plots
tinyplot(iris, by = "Species", frames = TRUE)
## another option (but assumes objects of equal length)
tinyplot(iris[, 1:4], by = iris$Species, frames = TRUE)
## tinypairs can also create 2x2 pairs display
tinypairs(iris[, c(3, 1)], by = iris$Species)
tinytheme() ## reset theme
Run the code above in your browser using DataLab