diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 86411f47..78155482 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -28,10 +28,11 @@ jobs: config: - {os: macOS-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: '3.6'} - - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"} + - {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } - {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} - {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"} @@ -60,7 +61,7 @@ jobs: uses: actions/cache@v2 with: path: | - ${{ env.R_LIBS_USER }} + ${{ env.R_LIBS_USER }}/* !${{ env.R_LIBS_USER }}/pak key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- @@ -104,3 +105,8 @@ jobs: with: name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results path: check + + - name: Don't use tar from old Rtools to store the cache + if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }} + shell: bash + run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH diff --git a/R/colours.R b/R/colours.R deleted file mode 100644 index 5724e11d..00000000 --- a/R/colours.R +++ /dev/null @@ -1,13 +0,0 @@ -#' Colour datasets -#' -#' All datasets have at least two columns: -#' * `label`: Text label of the colour. -#' * `hex`: Hex code of the colour. -#' -#' In `scenario_colours`, colours are ordered from red to green to be used in -#' trajectory charts. -#' -#' @aliases scenario_colours sector_colours technology_colours -#' @keywords internal -"palette_colours" - diff --git a/R/plot_techmixX.R b/R/plot_techmixX.R index 76a3e06b..54ac37bd 100644 --- a/R/plot_techmixX.R +++ b/R/plot_techmixX.R @@ -7,12 +7,12 @@ #' * The column `metric` must have a portfolio (e.g. "projected"), a benchmark #' (e.g. "corporate_economy"), and a single `scenario` (e.g. "target_sds"). #' -#' @return A "ggplot". -#' @export -#' #' @family functions with minimal arguments #' @seealso [market_share]. #' +#' @return An object of class "ggplot". +#' +#' @export #' @examples #' library(dplyr, warn.conflicts = FALSE) #' diff --git a/R/plot_techmixY.R b/R/plot_techmixY.R index e3fc0e62..751a82a4 100644 --- a/R/plot_techmixY.R +++ b/R/plot_techmixY.R @@ -15,6 +15,8 @@ #' #' @family plotting functions #' +#' @return An object of class "ggplot". +#' #' @export #' @examples #' data <- prep_techmixY( diff --git a/R/plot_timelineX.R b/R/plot_timelineX.R index dcffef98..4044ea06 100644 --- a/R/plot_timelineX.R +++ b/R/plot_timelineX.R @@ -6,12 +6,12 @@ #' @inheritParams prep_timelineY #' @inheritParams plot_timelineY #' -#' @return A "ggplot". -#' @export -#' #' @family functions with minimal arguments #' @seealso [sda]. #' +#' @return An object of class "ggplot". +#' +#' @export #' @examples #' library(dplyr, warn.conflicts = FALSE) #' diff --git a/R/plot_timelineY.R b/R/plot_timelineY.R index a2fb08b1..b6faafff 100644 --- a/R/plot_timelineY.R +++ b/R/plot_timelineY.R @@ -15,6 +15,7 @@ #' allows custom recoding via a data frame passed to the argument `specs`. #' #' @seealso [sda], [timeline_specs]. +#' #' @return An object of class "ggplot". #' #' @export diff --git a/R/plot_trajectoryX.R b/R/plot_trajectoryX.R index 443d941a..76bbda35 100644 --- a/R/plot_trajectoryX.R +++ b/R/plot_trajectoryX.R @@ -10,12 +10,12 @@ #' @inheritParams prep_trajectoryY #' @inheritParams prep_timelineY #' -#' @return A "ggplot". -#' @export -#' #' @family functions with minimal arguments #' @seealso [market_share]. #' +#' @return An object of class "ggplot". +#' +#' @export #' @examples #' library(dplyr, warn.conflicts = FALSE) #' diff --git a/R/plot_trajectoryY.R b/R/plot_trajectoryY.R index a0c6a58d..803945da 100644 --- a/R/plot_trajectoryY.R +++ b/R/plot_trajectoryY.R @@ -23,6 +23,8 @@ #' #' @family plotting functions #' +#' @return An object of class "ggplot". +#' #' @export #' @examples #' data <- prep_trajectoryY( diff --git a/R/prep_techmixY.R b/R/prep_techmixY.R index 12b7b6bc..e8534cb4 100644 --- a/R/prep_techmixY.R +++ b/R/prep_techmixY.R @@ -9,6 +9,8 @@ #' @param scenario_filter String of length 1. Scenario to pick from the `data`. #' @inheritParams prep_timelineY #' +#' @return An object of class "ggplot". +#' #' @export #' @examples #' prep_techmixY( diff --git a/R/prep_timelineY.R b/R/prep_timelineY.R index ccb34344..772ed311 100644 --- a/R/prep_timelineY.R +++ b/R/prep_timelineY.R @@ -12,8 +12,8 @@ #' @seealso [sda]. #' #' @return Data frame with columns: year, line_name, value, extrapolated. -#' @export #' +#' @export #' @examples #' library(dplyr, warn.conflicts = FALSE) #' diff --git a/R/r2dii_colours.R b/R/r2dii_colours.R new file mode 100644 index 00000000..6f2e9d23 --- /dev/null +++ b/R/r2dii_colours.R @@ -0,0 +1,32 @@ +#' Colour datasets +#' +#' All datasets have at least two columns: +#' * `label`: Text label of the colour. +#' * `hex`: Hex code of the colour. +#' +#' In `scenario_colours`, colours are ordered from red to green to be used in +#' trajectory charts. +#' +#' @name r2dii_colours +#' @keywords internal +#' +#' @examples +#' r2dii.plot:::palette_colours +#' +#' r2dii.plot:::scenario_colours +#' +#' r2dii.plot:::sector_colours +#' +#' r2dii.plot:::technology_colours +#' +NULL + +#' @rdname r2dii_colours +"palette_colours" +#' @rdname r2dii_colours +"scenario_colours" +#' @rdname r2dii_colours +"sector_colours" +#' @rdname r2dii_colours +"technology_colours" + diff --git a/R/theme_2dii.R b/R/theme_2dii.R index 23dd2304..7daa6a13 100644 --- a/R/theme_2dii.R +++ b/R/theme_2dii.R @@ -8,6 +8,7 @@ #' @family plotting functions #' #' @return An object of class `r toString(class(theme_2dii()))`. +#' #' @export #' @examples #' library(ggplot2, warn.conflicts = FALSE) diff --git a/R/timeline_specs.R b/R/timeline_specs.R index 6393c5ca..79ca8883 100644 --- a/R/timeline_specs.R +++ b/R/timeline_specs.R @@ -3,7 +3,9 @@ #' @inheritParams plot_timelineY #' #' @seealso plot_timelineA +#' #' @return A data frame useful as the `specs` argument of [plot_timelineY()]. +#' #' @export #' @examples #' data <- prep_timelineY(sda, sector_filter = "cement") diff --git a/README.Rmd b/README.Rmd index aac55614..cf609093 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,7 +21,6 @@ knitr::opts_chunk$set( experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html) [![Codecov test coverage](https://codecov.io/gh/2DegreesInvesting/r2dii.plot/branch/master/graph/badge.svg)](https://codecov.io/gh/2DegreesInvesting/r2dii.plot?branch=master) [![R-CMD-check](https://github.com/2DegreesInvesting/r2dii.plot/workflows/R-CMD-check/badge.svg)](https://github.com/2DegreesInvesting/r2dii.plot/actions) -[![CRAN status](https://www.r-pkg.org/badges/version/r2dii.plot)](https://CRAN.R-project.org/package=r2dii.plot) ```{r echo=FALSE} diff --git a/README.md b/README.md index acd98fe9..ad9a6ff1 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](h [![Codecov test coverage](https://codecov.io/gh/2DegreesInvesting/r2dii.plot/branch/master/graph/badge.svg)](https://codecov.io/gh/2DegreesInvesting/r2dii.plot?branch=master) [![R-CMD-check](https://github.com/2DegreesInvesting/r2dii.plot/workflows/R-CMD-check/badge.svg)](https://github.com/2DegreesInvesting/r2dii.plot/actions) -[![CRAN -status](https://www.r-pkg.org/badges/version/r2dii.plot)](https://CRAN.R-project.org/package=r2dii.plot) The goal of r2dii.plot is to help you plot 2DII data in an informative, diff --git a/cran-comments.md b/cran-comments.md index 374b4f16..4010f4b9 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,7 @@ ## Test environments -* ubuntu 18.04 (local), R 4.0.3 -* ubuntu 16.04 (github actions), R-oldrel, R-release, R-devel +* ubuntu 18.04 (local), R 4.1.0 +* ubuntu 18.04 (github actions), R-oldrel, R-release, R-devel * macOS-latest (github actions), R-release * windows-latest (github actions), R-oldrel, R-release * win-builder, R-release, R-devel diff --git a/data-raw/colours.R b/data-raw/r2dii_colours.R similarity index 100% rename from data-raw/colours.R rename to data-raw/r2dii_colours.R diff --git a/man/palette_colours.Rd b/man/palette_colours.Rd deleted file mode 100644 index 7524f1c2..00000000 --- a/man/palette_colours.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/colours.R -\docType{data} -\name{palette_colours} -\alias{palette_colours} -\alias{scenario_colours} -\alias{sector_colours} -\alias{technology_colours} -\title{Colour datasets} -\format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 9 rows and 2 columns. -} -\usage{ -palette_colours -} -\description{ -All datasets have at least two columns: -\itemize{ -\item \code{label}: Text label of the colour. -\item \code{hex}: Hex code of the colour. -} -} -\details{ -In \code{scenario_colours}, colours are ordered from red to green to be used in -trajectory charts. -} -\keyword{internal} diff --git a/man/plot_techmixX.Rd b/man/plot_techmixX.Rd index 591af251..162015fe 100644 --- a/man/plot_techmixX.Rd +++ b/man/plot_techmixX.Rd @@ -17,7 +17,7 @@ plot_techmixX(data) }} } \value{ -A "ggplot". +An object of class "ggplot". } \description{ Create a techmix plot diff --git a/man/plot_techmixY.Rd b/man/plot_techmixY.Rd index 94231015..8eaa41a5 100644 --- a/man/plot_techmixY.Rd +++ b/man/plot_techmixY.Rd @@ -24,6 +24,9 @@ in 'metric type order'.} \item{tech_colours}{Data frame containing colours per technology, with columns: technology, colour, label(optional).} } +\value{ +An object of class "ggplot". +} \description{ The function returns a ggplot object containing a stacked bar chart showing a technology mix for different categories (portfolio, scenario, benchmark, diff --git a/man/plot_timelineX.Rd b/man/plot_timelineX.Rd index ba0de624..1a7db6d4 100644 --- a/man/plot_timelineX.Rd +++ b/man/plot_timelineX.Rd @@ -17,7 +17,7 @@ plot_timelineX(data, extrapolate = FALSE) furthest value in the data set.} } \value{ -A "ggplot". +An object of class "ggplot". } \description{ Create a timeline plot diff --git a/man/plot_trajectoryX.Rd b/man/plot_trajectoryX.Rd index 98895524..7cc1cbc9 100644 --- a/man/plot_trajectoryX.Rd +++ b/man/plot_trajectoryX.Rd @@ -21,7 +21,7 @@ the most visual salience (solid black line). \code{NULL} defaults to "projected".} } \value{ -A "ggplot". +An object of class "ggplot". } \description{ Create a trajectory plot diff --git a/man/plot_trajectoryY.Rd b/man/plot_trajectoryY.Rd index d214561d..7c5f9fd1 100644 --- a/man/plot_trajectoryY.Rd +++ b/man/plot_trajectoryY.Rd @@ -26,6 +26,9 @@ should be plotted as the main line; with columns: metric, label.} additional metrics that should be plotted as lines; with columns: metric, label).} } +\value{ +An object of class "ggplot". +} \description{ We are exploring different interfaces before release. We are keen to hear feedback from beta-testers like you. Please try these diff --git a/man/prep_techmixY.Rd b/man/prep_techmixY.Rd index 55f63e04..d91575db 100644 --- a/man/prep_techmixY.Rd +++ b/man/prep_techmixY.Rd @@ -36,6 +36,9 @@ to plot.} \item{scenario_filter}{String of length 1. Scenario to pick from the \code{data}.} } +\value{ +An object of class "ggplot". +} \description{ Prepare the output of \code{r2dii.analysis::target_market_share()} for \code{plot_techmixY()} } diff --git a/man/r2dii_colours.Rd b/man/r2dii_colours.Rd new file mode 100644 index 00000000..28e2049e --- /dev/null +++ b/man/r2dii_colours.Rd @@ -0,0 +1,51 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/r2dii_colours.R +\docType{data} +\name{r2dii_colours} +\alias{r2dii_colours} +\alias{palette_colours} +\alias{scenario_colours} +\alias{sector_colours} +\alias{technology_colours} +\title{Colour datasets} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 9 rows and 2 columns. + +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 5 rows and 2 columns. + +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 8 rows and 2 columns. + +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 18 rows and 4 columns. +} +\usage{ +palette_colours + +scenario_colours + +sector_colours + +technology_colours +} +\description{ +All datasets have at least two columns: +\itemize{ +\item \code{label}: Text label of the colour. +\item \code{hex}: Hex code of the colour. +} +} +\details{ +In \code{scenario_colours}, colours are ordered from red to green to be used in +trajectory charts. +} +\examples{ +r2dii.plot:::palette_colours + +r2dii.plot:::scenario_colours + +r2dii.plot:::sector_colours + +r2dii.plot:::technology_colours + +} +\keyword{datasets} +\keyword{internal}