From 12aed5c42fbed388e957024d56d004dd2cc7d11a Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Mon, 25 Nov 2024 15:41:18 -0600 Subject: [PATCH] Mention the pipe more explicitly And switch to pak --- README.Rmd | 14 +++++++++++--- README.md | 17 ++++++++++++++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/README.Rmd b/README.Rmd index 7092002..cac8927 100644 --- a/README.Rmd +++ b/README.Rmd @@ -19,7 +19,15 @@ knitr::opts_chunk$set( [![R-CMD-check](https://github.com/hadley/ggplot1/actions/workflows/R-CMD-check.yaml/badge.svghttps://github.com/hadley/ggplot1/actions/workflows/R-CMD-check.yaml/badge.svghttps://github.com/hadley/ggplot1/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/hadley/ggplot1/actions/workflows/R-CMD-check.yaml) -ggplot1 is an update of ggplot, the package that preceded ggplot2. ggplot1 is mostly made available out of historical interest, to illustrate how my thinking about API design in R has evolved over the years. I've made a few minor tweaks to the package, mostly fixing small things that obscure the interesting parts of the API. +ggplot1 is an update of ggplot, the package that preceded ggplot2. ggplot1 is mostly made available out of historical interest, to illustrate how my thinking about API design in R has evolved over the years. I've made a few minor tweaks to the package, mostly fixing small things that obscure the interesting parts of the API. +The most interesting thing about ggplot1 is that it was originally designed around the idea of function composition, so that you'd write code like this: + +```{r} +#| eval: false +ggpoint(ggplot(mtcars, list(x = mpg, y = wt))) +``` + +I correct recognised that this was hard for people to read and write, but solved this problem in ggplot2 by overloading addition. In hindsight, this problem is solved generally by the pipe! ggplot had 7 CRAN releases starting with 0.2.2 in April 2006, and finishing with 0.4.2 in October 2008. @@ -28,8 +36,8 @@ ggplot had 7 CRAN releases starting with 0.2.2 in April 2006, and finishing with You can install ggplot1 from github with: ```R -# install.packages("devtools") -devtools::install_github("hadley/ggplot1") +# install.packages("pak") +pak::pak("hadley/ggplot1") ``` ## Usage diff --git a/README.md b/README.md index ac6faa8..ed274b7 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,18 @@ ggplot1 is an update of ggplot, the package that preceded ggplot2. ggplot1 is mostly made available out of historical interest, to illustrate how my thinking about API design in R has evolved over the years. I’ve made a few minor tweaks to the package, mostly fixing small -things that obscure the interesting parts of the API. +things that obscure the interesting parts of the API. The most +interesting thing about ggplot1 is that it was originally designed +around the idea of function composition, so that you’d write code like +this: + +``` r +ggpoint(ggplot(mtcars, list(x = mpg, y = wt))) +``` + +I correct recognised that this was hard for people to read and write, +but solved this problem in ggplot2 by overloading addition. In +hindsight, this problem is solved generally by the pipe! ggplot had 7 CRAN releases starting with 0.2.2 in April 2006, and finishing with 0.4.2 in October 2008. @@ -22,8 +33,8 @@ finishing with 0.4.2 in October 2008. You can install ggplot1 from github with: ``` r -# install.packages("devtools") -devtools::install_github("hadley/ggplot1") +# install.packages("pak") +pak::pak("hadley/ggplot1") ``` ## Usage