Skip to content

Commit 8caeb59

Browse files
authored
Merge pull request #65 from chrbknudsen/main
fra %>% til |>
2 parents 0c58b77 + 63e35b6 commit 8caeb59

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

episodes/danstat.Rmd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ parameter "variables_only = T".
186186
What kind of values can the individual datapoints take?
187187

188188
```{r get-values}
189-
metadata %>%
190-
slice(4) %>%
189+
metadata |>
190+
slice(4) |>
191191
pull(values)
192192
```
193193

@@ -198,11 +198,11 @@ column.
198198
The same trick can be done for the other fields in the table:
199199

200200
```{r municipalites}
201-
metadata %>%
202-
slice(1) %>%
203-
pull(values) %>%
204-
.[[1]] %>%
205-
head
201+
metadata |>
202+
slice(1) |>
203+
pull(values) |>
204+
.[[1]] |>
205+
head()
206206
```
207207
Here we see the individual municipalities in Denmark.
208208

@@ -249,8 +249,8 @@ That information is stored in the variable "CIVILSTAND".
249249

250250
And above, we saw that we had the following values in that variable:
251251
```{r pulling-values}
252-
metadata %>%
253-
slice(4) %>%
252+
metadata |>
253+
slice(4) |>
254254
pull(values)
255255
```
256256

episodes/getting-data.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ specify the result that we want:
155155

156156
```{r specific-joke}
157157
library(tidyverse)
158-
GET("https://icanhazdadjoke.com/j/lGJmrrzAsc", accept("text/plain")) %>%
158+
GET("https://icanhazdadjoke.com/j/lGJmrrzAsc", accept("text/plain")) |>
159159
content()
160160
```
161161

@@ -174,7 +174,7 @@ it to *result*:
174174

175175
```{r dog-jokes}
176176
result <- GET("https://icanhazdadjoke.com/search?term=dog",
177-
accept("application/json")) %>%
177+
accept("application/json")) |>
178178
content()
179179
result
180180
```
@@ -188,8 +188,8 @@ convert it to a data frame. We begin by loading the library:
188188

189189
```{r extract-from-json}
190190
library(jsonlite)
191-
GET("https://icanhazdadjoke.com/search?term=dog", accept("application/json")) %>%
192-
content(as="text") %>%
191+
GET("https://icanhazdadjoke.com/search?term=dog", accept("application/json")) |>
192+
content(as="text") |>
193193
fromJSON()
194194
```
195195

@@ -215,8 +215,8 @@ Request dad jokes about cats
215215
## Solution
216216

217217
```{r}
218-
GET("https://icanhazdadjoke.com/search?term=dog", accept("application/json")) %>%
219-
content(as="text") %>%
218+
GET("https://icanhazdadjoke.com/search?term=dog", accept("application/json")) |>
219+
content(as="text") |>
220220
fromJSON()
221221
```
222222

0 commit comments

Comments
 (0)