From 4ea1e2c55b743449a73ae01b794297a672e94540 Mon Sep 17 00:00:00 2001 From: Peter Desmet Date: Fri, 20 Feb 2026 15:55:02 +0100 Subject: [PATCH 1/2] Use base pipes --- README.Rmd | 5 ++--- README.md | 4 ++-- vignettes/data-package.Rmd | 6 +++--- vignettes/frictionless.Rmd | 16 +++++++--------- vignettes/frictionless.Rmd.orig | 13 +++++-------- 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/README.Rmd b/README.Rmd index e317a31..f1ea78e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -11,7 +11,6 @@ knitr::opts_chunk$set( fig.path = "man/figures/README-", out.width = "100%" ) -library(dplyr) # For %>% ``` # frictionless @@ -82,13 +81,13 @@ You can also create your own Data Package, add data and **write** it to disk: ```{r write_example} # Create a Data Package and add the "iris" data frame as a resource my_package <- - create_package() %>% + create_package() |> add_resource(resource_name = "iris", data = iris) my_package # Write the Data Package to disk -my_package %>% +my_package |> write_package("my_directory") ``` diff --git a/README.md b/README.md index 15887a2..2e82307 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ disk: ``` r # Create a Data Package and add the "iris" data frame as a resource my_package <- - create_package() %>% + create_package() |> add_resource(resource_name = "iris", data = iris) my_package @@ -128,7 +128,7 @@ my_package #> Use `unclass()` to print the Data Package as a list. # Write the Data Package to disk -my_package %>% +my_package |> write_package("my_directory") ``` diff --git a/vignettes/data-package.Rmd b/vignettes/data-package.Rmd index 5f05426..78990b2 100644 --- a/vignettes/data-package.Rmd +++ b/vignettes/data-package.Rmd @@ -78,9 +78,9 @@ Most functions have `package` as their first argument and return package. This a ```{r, message = FALSE} library(dplyr) # Or library(magrittr) my_package <- - create_package() %>% - add_resource(resource_name = "iris", data = iris) %>% - append(c("title" = "my_package"), after = 0) %>% + create_package() |> + add_resource(resource_name = "iris", data = iris) |> + append(c("title" = "my_package"), after = 0) |> create_package() # To add the datapackage class again my_package ``` diff --git a/vignettes/frictionless.Rmd b/vignettes/frictionless.Rmd index f291f94..f13b9f4 100644 --- a/vignettes/frictionless.Rmd +++ b/vignettes/frictionless.Rmd @@ -165,16 +165,13 @@ Create a Data Package with `create_package()` and add your data frame as a resou ``` r -# Load dplyr or magrittr to support %>% pipes -library(dplyr, warn.conflicts = FALSE) # or library(magrittr) - my_package <- - create_package() %>% + create_package() |> add_resource(resource_name = "iris", data = iris) ``` ::: {.callout-info} -You can chain most frictionless functions together using pipes (`%>%` or `|>`), which improves readability. +You can chain most frictionless functions together using pipes (`|>`), which improves readability. ::: `my_package` now contains one resource: @@ -192,7 +189,7 @@ By default, `add_resource()` will create a **Table Schema** for your data frame, ``` r iris_schema <- - my_package %>% + my_package |> schema("iris") str(iris_schema) @@ -310,7 +307,7 @@ Let's add `iris` as a resource to your Data Package again, but this time with th ``` r my_package <- - my_package %>% + my_package |> add_resource( resource_name = "iris", data = iris, @@ -331,7 +328,7 @@ path_2 <- system.file("extdata", "v1", "observations_2.tsv", package = "friction # Add both TSV files as a single resource my_package <- - my_package %>% + my_package |> add_resource( resource_name = "observations", data = c(path_1, path_2), @@ -369,7 +366,8 @@ The directory will contain four files: the descriptor `datapackage.json`, one CS ``` r list.files("my_directory") -#> [1] "datapackage.json" "iris.csv" "observations_1.tsv" "observations_2.tsv" +#> [1] "datapackage.json" "iris.csv" "observations_1.tsv" +#> [4] "observations_2.tsv" ``` diff --git a/vignettes/frictionless.Rmd.orig b/vignettes/frictionless.Rmd.orig index ddfcbbf..07404b0 100644 --- a/vignettes/frictionless.Rmd.orig +++ b/vignettes/frictionless.Rmd.orig @@ -88,16 +88,13 @@ dplyr::as_tibble(iris) Create a Data Package with `create_package()` and add your data frame as a resource with the name `iris`: ```{r} -# Load dplyr or magrittr to support %>% pipes -library(dplyr, warn.conflicts = FALSE) # or library(magrittr) - my_package <- - create_package() %>% + create_package() |> add_resource(resource_name = "iris", data = iris) ``` ::: {.callout-info} -You can chain most frictionless functions together using pipes (`%>%` or `|>`), which improves readability. +You can chain most frictionless functions together using pipes (`|>`), which improves readability. ::: `my_package` now contains one resource: @@ -110,7 +107,7 @@ By default, `add_resource()` will create a **Table Schema** for your data frame, ```{r} iris_schema <- - my_package %>% + my_package |> schema("iris") str(iris_schema) @@ -158,7 +155,7 @@ Let's add `iris` as a resource to your Data Package again, but this time with th ```{r} my_package <- - my_package %>% + my_package |> add_resource( resource_name = "iris", data = iris, @@ -178,7 +175,7 @@ path_2 <- system.file("extdata", "v1", "observations_2.tsv", package = "friction # Add both TSV files as a single resource my_package <- - my_package %>% + my_package |> add_resource( resource_name = "observations", data = c(path_1, path_2), From d87d40933639ca47839c31e58fe6b72c5bd31f16 Mon Sep 17 00:00:00 2001 From: Peter Desmet Date: Fri, 20 Feb 2026 15:58:18 +0100 Subject: [PATCH 2/2] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b8a7dc7..fa1c81e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,7 @@ * `resources()` is soft-deprecated, please use `resource_names()` instead (#282). * `get_schema()` is soft-deprecated, please use `schema()` instead (#282). * `read_resource()` now supports reading from remote zip files, thanks to support in {vroom} (1.3.0) (#291). -* frictionless now relies on R >= 4.1.0 (because of an indirect {vroom} dependency) (#291). +* frictionless now relies on R >= 4.1.0 (because of an indirect {vroom} dependency) (#291) and uses base pipes (`|>` rather than `%>%`) (#292). # frictionless 1.2.1