From 9aba44e687c255ca6050c1f8af4cbb10859507bb Mon Sep 17 00:00:00 2001 From: Duncan Garmonsway Date: Sat, 23 Nov 2024 22:36:45 +0000 Subject: [PATCH] Upgrade GitHub workflow and render README --- .github/workflows/R-CMD-check.yaml | 80 +++++++++--------------------- README.Rmd | 4 +- README.md | 31 ++++++++---- 3 files changed, 46 insertions(+), 69 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index cea7ca2..562fe0f 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,16 +1,13 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - branches: - - main - - master + branches: [main, master] pull_request: - branches: - - main - - master -name: R-CMD-check +name: R-CMD-check.yaml + +permissions: read-all jobs: R-CMD-check: @@ -22,64 +19,33 @@ jobs: fail-fast: false matrix: config: + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} - - {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v1 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") - shell: Rscript {0} - - - name: Restore R package cache - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - - name: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: | - options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/README.Rmd b/README.Rmd index b369afa..1fb5047 100644 --- a/README.Rmd +++ b/README.Rmd @@ -14,12 +14,14 @@ knitr::opts_chunk$set( # unpivotr + [![Travis-CI Build Status](https://travis-ci.org/nacnudus/unpivotr.svg?branch=master)](https://travis-ci.org/nacnudus/unpivotr) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/nacnudus/unpivotr?branch=master&svg=true)](https://ci.appveyor.com/project/nacnudus/unpivotr) [![Cran Status](http://www.r-pkg.org/badges/version/unpivotr)](https://CRAN.R-project.org/package=unpivotr) [![Cran Downloads](https://cranlogs.r-pkg.org/badges/unpivotr)](https://www.r-pkg.org/pkg/unpivotr) [![codecov](https://codecov.io/github/nacnudus/unpivotr/coverage.svg?branch=master)](https://app.codecov.io/gh/nacnudus/unpivotr) -[![R-CMD-check](https://github.com/nacnudus/unpivotr/workflows/R-CMD-check/badge.svg)](https://github.com/nacnudus/unpivotr/actions) +[![R-CMD-check](https://github.com/nacnudus/unpivotr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nacnudus/unpivotr/actions/workflows/R-CMD-check.yaml) + [unpivotr](https://github.com/nacnudus/unpivotr) deals with non-tabular data, especially from spreadsheets. Use unpivotr when your source data has any of diff --git a/README.md b/README.md index 35ecbeb..2014876 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ # unpivotr + + [![Travis-CI Build Status](https://travis-ci.org/nacnudus/unpivotr.svg?branch=master)](https://travis-ci.org/nacnudus/unpivotr) [![AppVeyor Build @@ -12,7 +14,8 @@ Status](http://www.r-pkg.org/badges/version/unpivotr)](https://CRAN.R-project.or [![Cran Downloads](https://cranlogs.r-pkg.org/badges/unpivotr)](https://www.r-pkg.org/pkg/unpivotr) [![codecov](https://codecov.io/github/nacnudus/unpivotr/coverage.svg?branch=master)](https://app.codecov.io/gh/nacnudus/unpivotr) -[![R-CMD-check](https://github.com/nacnudus/unpivotr/workflows/R-CMD-check/badge.svg)](https://github.com/nacnudus/unpivotr/actions) +[![R-CMD-check](https://github.com/nacnudus/unpivotr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/nacnudus/unpivotr/actions/workflows/R-CMD-check.yaml) + [unpivotr](https://github.com/nacnudus/unpivotr) deals with non-tabular data, especially from spreadsheets. Use unpivotr when your source data @@ -61,8 +64,12 @@ More positive, corrective functions: Unpivotr uses data where each cells is represented by one row in a dataframe. Like this. -![Gif of tidyxl converting cells into a tidy representation of one row -per cell](./vignettes/tidy_xlsx.gif) +
+ + +
What can you do with tidy cells? The best places to start are: @@ -96,16 +103,18 @@ Otherwise the basic idea is: ``` r library(unpivotr) library(tidyverse) -#> ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ── -#> ✔ ggplot2 3.3.6 ✔ purrr 0.3.4 -#> ✔ tibble 3.1.8 ✔ dplyr 1.0.10 -#> ✔ tidyr 1.2.1 ✔ stringr 1.4.1 -#> ✔ readr 2.1.2 ✔ forcats 0.5.2 +#> ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── +#> ✔ dplyr 1.1.4 ✔ readr 2.1.5 +#> ✔ forcats 1.0.0 ✔ stringr 1.5.1 +#> ✔ ggplot2 3.5.1 ✔ tibble 3.2.1 +#> ✔ lubridate 1.9.3 ✔ tidyr 1.3.1 +#> ✔ purrr 1.0.2 #> ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── #> ✖ dplyr::filter() masks stats::filter() #> ✖ dplyr::lag() masks stats::lag() #> ✖ tidyr::pack() masks unpivotr::pack() #> ✖ tidyr::unpack() masks unpivotr::unpack() +#> ℹ Use the conflicted package () to force all conflicts to become errors x <- purpose$`up-left left-up` x # A pivot table in a conventional data frame. Four levels of headers, in two #> X2 X3 X4 X5 X6 X7 @@ -148,7 +157,7 @@ y #> 8 8 1 chr #> 9 9 1 chr #> 10 10 1 chr -#> # … with 122 more rows +#> # ℹ 122 more rows rectify(y) # useful for reviewing the melted form as though in a spreadsheet #> # A tibble: 22 × 7 @@ -164,7 +173,7 @@ rectify(y) # useful for reviewing the melted form as though in a spreadsheet #> 8 8 25 - 44 34000 179000 31000 219000 #> 9 9 45 - 64 30000 210000 23000 199000 #> 10 10 65+ 12000 77000 8000 107000 -#> # … with 12 more rows +#> # ℹ 12 more rows y %>% behead("up-left", "sex") %>% # Strip headers @@ -186,7 +195,7 @@ y %>% #> 8 18000 Female 7 - 10 Bachelor's degree 65+ #> 9 NA Male 0 - 6 Bachelor's degree 15 - 24 #> 10 9000 Male 0 - 6 Bachelor's degree 25 - 44 -#> # … with 70 more rows +#> # ℹ 70 more rows ``` Note the compass directions in the code above, which hint to `behead()`