I am getting error when trying to use the preserve argument to position_dodge() described here in the ggplot documentation.
ggplot(
mtcars,
aes(
factor(cyl),
fill = factor(vs)
)
) +
geom_bar(position = position_dodge(preserve = "single"))
Error in position_dodge(preserve = "single") : unused argument (preserve = "single")
I am using R version 3.4.1 and ggplot2 version 2.2.1
Any suggestions? Thanks
It looks like the
preserve
argument is present in the development version ofggplot2
but for the moment only in the functionposition_dodge2()
and not in the normalposition_dodge()
function. This link shows how I found that information: https://github.com/tidyverse/ggplot2/search?utf8=%E2%9C%93&q=preserve&type=It's unclear to me why the online documentation (http://ggplot2.tidyverse.org/reference/index.html) shows
preserve
as a current, usable feature.If you really want to use this function you could try installing the development version. I have no idea if that would be a good idea or not!