This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How To View The Source Code Of Ggplot2

Dear all, does anybody know how to check the source code of the functions of ggplot2?

> stat_density
function (mapping = NULL, data = NULL, geom = "area", position = "stack", 
    adjust = 1, kernel = "gaussian", trim = FALSE, na.rm = FALSE, 
    ...) 
{
    StatDensity$new(mapping = mapping, data = data, geom = geom, 
        position = position, adjust = adjust, kernel = kernel, 
        trim = trim, na.rm = na.rm, ...)
}
<environment: namespace:ggplot2>
r

Generally, exported function can be viewed within R as follows:

ggplot2::qplot

i.e. package_name [double colon] function_name.

Where a function is not exported to the user, you can access the source code of these using a triple colon.

1 answer

One inconvenient way is to check the source code directly: https://github.com/hadley/ggplot2/blob/master/R

Log in to answer this question.