Skip to content

Default types should be smarter about characters #321

@grantmcdermott

Description

@grantmcdermott

For example, this should default to type_boxplot().

library(tinyplot)

set.seed(0)
x <- rep(c("A", "B", "C"), each = 20)
y <- runif(60)
gp <- sample(c("X", "Y", "Z"), size = 60, replace = TRUE)
df <- data.frame(x, y, gp)

plt(
  y ~ x | gp,
  data = df
)
#> Error in Summary.factor(structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, : 'range' not meaningful for factors

Separately, we shouldn't run into errors when x or y are characters/factors for points anyway. (This is the error above.) I'll address both issues in a PR shortly.

P.S. We coerce characters to factors lower in the main tinyplot.R code, but type sanitizing needs to happen earlier here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions