grantmcdermott · GitHub

The boxplots look great, thanks Grant @grantmcdermott ! I played around with various combinations of by and facet and boxplot-specific arguments. Everything worked as intended except one extremely contrived example (see below).

I mainly wondered about the computation of x_by. First, why is it set to FALSE except for type == "boxplot" in

Second, it is done rather early now but x and by might have been modified already in tinyplot.default.

As for the first point: I don't understand the logic why this should be limited to boxplots. The logic should also apply to other plot types, even if these choose to ignore the x_by argument.

And an example, where the x_by gets FALSE even though it should be TRUE is if both variables are numeric. The reason is that by gets coerced to factor before the comparison. Due to this the following plots are not the same, although they should:

tinyplot(mpg ~ factor(gear) | factor(gear), facet = "by", data = mtcars, type = "boxplot")
tinyplot(mpg ~ gear | gear, facet = "by", data = mtcars, type = "boxplot")

Read the original on github.com ↗