Provides a formula interface to 'ggplot2' graphics.
ggformula introduces a family of graphics functions,
gf_density(), and so on, bring the formula interface to
captures and extends the excellent simplicity of the
interface, while providing the intuitive "add this component" capabilities of
Installations from CRAN are done in the usual way. The development version of the package is here on GitHub. To install it, use the following commands in your R system.
# Install devtools if necessaryinstall.packages("devtools")# Install ggformuladevtools::install_github("projectMOSAIC/ggformula")
Interactive tutorials demonstrating the package functionality can be run with
learnr::run_tutorial("introduction", package = "ggformula")learnr::run_tutorial("refining", package = "ggformula")
The package vignette is available at https://cran.r-project.org/package=ggformula/vignettes/ggformula.html.
This release includes a few minor improvements, including
ggplot2 (>= 3.0.0). This should take care of issues in 0.8.0 when
ggplot2was upgraded after upgrading
pkgdownwebsite created at https://projectmosaic.github.io/ggformula/
vdiffris used for testing plot output
The internals of all of the
gf_ functions have been modified to make them
ggplot2 version 2.3. In future releases, a version
least this new will be required.
The default value for
gf_smooth() has been changed from
gf_sf() added to support simple features data for maps.
improved documentation and examples
y ~ .can be used for plots that require a
yaesthetic but no
gf_rugy(). Also additional examples using rugs are given in the documentation.
gf_polygon()for simple maps. (Improved mapping capabilities should be coming when
ggplot2hits version 2.3.)
gf_functions makes it easier to work with data in the global environment.
gf_percents()added to simplify creating bar graphs on a proportion or percent scale.
gf_functions. In the case of
gf_percents()these are prepopulated with defaults of "proportion" and "percent" to give nicer labeling of the plot.
weatherDatahas been removed since that package is no longer on CRAN
gf_vline()expand the usable portion of the API.
Minor update primarily to support vignette data sets moving from
Mostly minor changes:
For version 0.5, the internals of
ggformula have been largely redesigned to allow
implementation of some new features. The new version relies much less on string parsing.
Some important changes to formula parsing include
attribute::expressionare no longer supported within the main formula.
gf_point(1:10 ~ 1:10)work, making it simpler to create on the fly plots without having to build a data frame first.
y ~ 1is equivalent to
~ yin functions that allow the
~ yformula shape. Example:
gf_histogram(age ~ 1)and
gf_histogram( ~ age)are equivalent
Some new functions have been added
gf_dist()can plot distributions
gf_dhistogram()plots density histograms by default
gf_ash()creates ASH plots
df_stats() has been improved to handle one-sided formulas better.
Secondary layers are now able to inherit both data and formula-defined attributes from the primary layer. Use
inherit = FALSE if you don't want inheritance. (A few functions have
inherit = FALSE as their default because
it seems unlikely that inheriting will be desireable.)
Version 0.4.0 constitutes a stable beta release. Changes to the API are still possible, but more likely future changes will focus on expansion of the suite of functions supplied, changes to the internal implementation, and improved documentation.
datamay now be an expression (like
data = KidsFeet %>% filter(sex == "G"))
gf_histogram()accepts formulas with shape
y ~ x. This makes it possible to create density histograms with
::to indicate mapping aesthetics. (
:will autodetect, but only if the value is the name of a variable in the data set.) This should be considered experimental.
gf_refine()which can be used to pass by chaining anything that would have been "added" in ``ggplot2`
gf_lm(), which is
method = "lm"
stat = "density".