Skip to content

Commit 97f91a2

Browse files
authored
Merge pull request #292 from frictionlessdata/base-pipes
Use base pipes
2 parents 8057b59 + d87d409 commit 97f91a2

File tree

6 files changed

+20
-26
lines changed

6 files changed

+20
-26
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* `resources()` is soft-deprecated, please use `resource_names()` instead (#282).
44
* `get_schema()` is soft-deprecated, please use `schema()` instead (#282).
55
* `read_resource()` now supports reading from remote zip files, thanks to support in {vroom} (1.3.0) (#291).
6-
* frictionless now relies on R >= 4.1.0 (because of an indirect {vroom} dependency) (#291).
6+
* frictionless now relies on R >= 4.1.0 (because of an indirect {vroom} dependency) (#291) and uses base pipes (`|>` rather than `%>%`) (#292).
77

88
# frictionless 1.2.1
99

README.Rmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ knitr::opts_chunk$set(
1111
fig.path = "man/figures/README-",
1212
out.width = "100%"
1313
)
14-
library(dplyr) # For %>%
1514
```
1615

1716
# frictionless
@@ -82,13 +81,13 @@ You can also create your own Data Package, add data and **write** it to disk:
8281
```{r write_example}
8382
# Create a Data Package and add the "iris" data frame as a resource
8483
my_package <-
85-
create_package() %>%
84+
create_package() |>
8685
add_resource(resource_name = "iris", data = iris)
8786
8887
my_package
8988
9089
# Write the Data Package to disk
91-
my_package %>%
90+
my_package |>
9291
write_package("my_directory")
9392
```
9493

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ disk:
119119
``` r
120120
# Create a Data Package and add the "iris" data frame as a resource
121121
my_package <-
122-
create_package() %>%
122+
create_package() |>
123123
add_resource(resource_name = "iris", data = iris)
124124

125125
my_package
@@ -128,7 +128,7 @@ my_package
128128
#> Use `unclass()` to print the Data Package as a list.
129129

130130
# Write the Data Package to disk
131-
my_package %>%
131+
my_package |>
132132
write_package("my_directory")
133133
```
134134

vignettes/data-package.Rmd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Most functions have `package` as their first argument and return package. This a
7878
```{r, message = FALSE}
7979
library(dplyr) # Or library(magrittr)
8080
my_package <-
81-
create_package() %>%
82-
add_resource(resource_name = "iris", data = iris) %>%
83-
append(c("title" = "my_package"), after = 0) %>%
81+
create_package() |>
82+
add_resource(resource_name = "iris", data = iris) |>
83+
append(c("title" = "my_package"), after = 0) |>
8484
create_package() # To add the datapackage class again
8585
my_package
8686
```

vignettes/frictionless.Rmd

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,13 @@ Create a Data Package with `create_package()` and add your data frame as a resou
165165

166166

167167
``` r
168-
# Load dplyr or magrittr to support %>% pipes
169-
library(dplyr, warn.conflicts = FALSE) # or library(magrittr)
170-
171168
my_package <-
172-
create_package() %>%
169+
create_package() |>
173170
add_resource(resource_name = "iris", data = iris)
174171
```
175172

176173
::: {.callout-info}
177-
You can chain most frictionless functions together using pipes (`%>%` or `|>`), which improves readability.
174+
You can chain most frictionless functions together using pipes (`|>`), which improves readability.
178175
:::
179176

180177
`my_package` now contains one resource:
@@ -192,7 +189,7 @@ By default, `add_resource()` will create a **Table Schema** for your data frame,
192189

193190
``` r
194191
iris_schema <-
195-
my_package %>%
192+
my_package |>
196193
schema("iris")
197194

198195
str(iris_schema)
@@ -310,7 +307,7 @@ Let's add `iris` as a resource to your Data Package again, but this time with th
310307

311308
``` r
312309
my_package <-
313-
my_package %>%
310+
my_package |>
314311
add_resource(
315312
resource_name = "iris",
316313
data = iris,
@@ -331,7 +328,7 @@ path_2 <- system.file("extdata", "v1", "observations_2.tsv", package = "friction
331328

332329
# Add both TSV files as a single resource
333330
my_package <-
334-
my_package %>%
331+
my_package |>
335332
add_resource(
336333
resource_name = "observations",
337334
data = c(path_1, path_2),
@@ -369,7 +366,8 @@ The directory will contain four files: the descriptor `datapackage.json`, one CS
369366

370367
``` r
371368
list.files("my_directory")
372-
#> [1] "datapackage.json" "iris.csv" "observations_1.tsv" "observations_2.tsv"
369+
#> [1] "datapackage.json" "iris.csv" "observations_1.tsv"
370+
#> [4] "observations_2.tsv"
373371
```
374372

375373

vignettes/frictionless.Rmd.orig

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,13 @@ dplyr::as_tibble(iris)
8888
Create a Data Package with `create_package()` and add your data frame as a resource with the name `iris`:
8989

9090
```{r}
91-
# Load dplyr or magrittr to support %>% pipes
92-
library(dplyr, warn.conflicts = FALSE) # or library(magrittr)
93-
9491
my_package <-
95-
create_package() %>%
92+
create_package() |>
9693
add_resource(resource_name = "iris", data = iris)
9794
```
9895

9996
::: {.callout-info}
100-
You can chain most frictionless functions together using pipes (`%>%` or `|>`), which improves readability.
97+
You can chain most frictionless functions together using pipes (`|>`), which improves readability.
10198
:::
10299

103100
`my_package` now contains one resource:
@@ -110,7 +107,7 @@ By default, `add_resource()` will create a **Table Schema** for your data frame,
110107

111108
```{r}
112109
iris_schema <-
113-
my_package %>%
110+
my_package |>
114111
schema("iris")
115112

116113
str(iris_schema)
@@ -158,7 +155,7 @@ Let's add `iris` as a resource to your Data Package again, but this time with th
158155

159156
```{r}
160157
my_package <-
161-
my_package %>%
158+
my_package |>
162159
add_resource(
163160
resource_name = "iris",
164161
data = iris,
@@ -178,7 +175,7 @@ path_2 <- system.file("extdata", "v1", "observations_2.tsv", package = "friction
178175

179176
# Add both TSV files as a single resource
180177
my_package <-
181-
my_package %>%
178+
my_package |>
182179
add_resource(
183180
resource_name = "observations",
184181
data = c(path_1, path_2),

0 commit comments

Comments
 (0)