Documentation for computed variables

Hi!

I've found that in many answers (mainly in SO), people use ..density.., ..count.., ..PANEL.. etc.

Where can I find the documentations of these? Or, at least can I find a list of the computed variables that I may use?

Thanks.

The newer stat() function (from about a year back) allows you to avoid that syntax for calculated aesthetics (and has better — i.e. existing — documentation).

https://ggplot2.tidyverse.org/dev/reference/stat.html

Calculated aesthetics

The new stat() function offers a cleaner, and better-documented syntax for calculated-aesthetic variables. This replaces the older approach of surrounding the variable name with .. . Instead of using aes(y = ..count..) , you can use aes(y = stat(count)) .

This is particularly nice for more complex calculations, as stat() only needs to be specified once; e.g. aes(y = stat(count / max(count))) rather than aes(y = ..count.. / max(..count..)) .

2 Likes

You can find the list in the help page for each geom_ also I think the current way to access computed variables is using stat()

Density, count and panel are general terms in statistics.

Density is the continuous distribution of values over a range by frequency. A common example is the normal distribution. There are other distributions for which tools are available in R{base} and other packages.

Count simply refers to the number, usually abbreviated n of observations. There are many count() functions available in R, many for specialized purposes such as genetics. The most general function that I am aware of is dplyr:count.

Panel is time series data, often referred to as "longitudinal" in medicine and social sciences. Econometricians are especially found of these terms.

Aside from wiki, the R Search Engine is a good resource for finding examples of packages implementing these concepts and the documentation or vignettes may provide additional insight.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.