Update plumbing
This commit is contained in:
parent
d0fca54370
commit
761fe9d591
|
@ -569,9 +569,9 @@ df |> pivot_wider(
|
|||
Since you don't know how to work with this sort of data yet, you'll want to follow the hint in the warning to figure out where the problem is:
|
||||
|
||||
```{r}
|
||||
df %>%
|
||||
group_by(id, name) %>%
|
||||
summarize(n = n(), .groups = "drop") %>%
|
||||
df |>
|
||||
group_by(id, name) |>
|
||||
summarize(n = n(), .groups = "drop") |>
|
||||
filter(n > 1L)
|
||||
```
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ If you commonly perform the same set of summaries when doing initial data explor
|
|||
|
||||
```{r}
|
||||
summary6 <- function(data, var) {
|
||||
data %>% summarise(
|
||||
data |> summarise(
|
||||
min = min({{ var }}, na.rm = TRUE),
|
||||
mean = mean({{ var }}, na.rm = TRUE),
|
||||
median = median({{ var }}, na.rm = TRUE),
|
||||
|
|
|
@ -698,12 +698,12 @@ If these case studies have whetted your appetite for more real-life rectangling,
|
|||
#| results: false
|
||||
tibble(json = got_chars) |>
|
||||
unnest_wider(json) |>
|
||||
select(id, where(is.list)) %>%
|
||||
select(id, where(is.list)) |>
|
||||
pivot_longer(
|
||||
where(is.list),
|
||||
names_to = "name",
|
||||
values_to = "value"
|
||||
) %>%
|
||||
) |>
|
||||
unnest_longer(value)
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue