Skip to content

Commit 4a4a1b0

Browse files
committed
Reformat again with better hugging and ~ behavior
1 parent 3b015a0 commit 4a4a1b0

17 files changed

+206
-198
lines changed

R/data-mask.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ DataMask <- R6Class(
5353
# reference is "fresh" and completely owned by this instance of the
5454
# `DataMask`. Otherwise nested `mutate()` calls can end up modifying
5555
# the same value (#6762).
56-
private$env_current_group_info <- new_environment(data = list(
56+
private$env_current_group_info <- new_environment(list(
5757
`dplyr:::current_group_id` = duplicate(0L),
5858
`dplyr:::current_group_size` = duplicate(0L)
5959
))

data-raw/starwars.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ starwars %>% count(sex, gender, sort = TRUE)
111111

112112
# see https://github.com/tidyverse/dplyr/pull/6840
113113
starwars = starwars %>%
114-
mutate(name = ifelse(
115-
name == "Beru Whitesun lars",
116-
"Beru Whitesun Lars",
117-
name
118-
))
114+
mutate(
115+
name = ifelse(name == "Beru Whitesun lars", "Beru Whitesun Lars", name)
116+
)
119117

120118
# Basic checks -------------------------------------------------------------
121119

@@ -129,7 +127,7 @@ starwars %>% group_by(species) %>% summarise(mass = mean(mass, na.rm = T))
129127

130128
# Save in convenient form for diffs
131129
starwars %>%
132-
mutate_if(is.list, ~map_chr(., paste, collapse = ", ")) %>%
130+
mutate_if(is.list, ~ map_chr(., paste, collapse = ", ")) %>%
133131
write_csv("data-raw/starwars.csv")
134132

135133
usethis::use_data(starwars, overwrite = TRUE)

data-raw/storms.R

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,17 @@ storms <- storms %>%
133133

134134
# hurricane category
135135
storms <- storms %>%
136-
mutate(category = case_when(
137-
status != "hurricane" ~ NA,
138-
wind >= 137 ~ 5,
139-
wind >= 113 ~ 4,
140-
wind >= 96 ~ 3,
141-
wind >= 83 ~ 2,
142-
wind >= 64 ~ 1,
143-
.default = NA
144-
)) %>%
136+
mutate(
137+
category = case_when(
138+
status != "hurricane" ~ NA,
139+
wind >= 137 ~ 5,
140+
wind >= 113 ~ 4,
141+
wind >= 96 ~ 3,
142+
wind >= 83 ~ 2,
143+
wind >= 64 ~ 1,
144+
.default = NA
145+
)
146+
) %>%
145147
relocate(category, .after = status)
146148

147149
# drop storms without at least one record that is a tropical depression or higher
@@ -158,11 +160,13 @@ storms <- storms %>%
158160

159161
# make names Title casing
160162
storms <- storms %>%
161-
mutate(name = if_else(
162-
str_sub(name, 1, 3) %in% c("AL0", "AL1"),
163-
name,
164-
str_to_title(name)
165-
))
163+
mutate(
164+
name = if_else(
165+
str_sub(name, 1, 3) %in% c("AL0", "AL1"),
166+
name,
167+
str_to_title(name)
168+
)
169+
)
166170

167171
# drop a bad data point (add more if found)
168172
storms <- storms %>%

inst/bench/bench.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ benchs <- function(libs, setup, ..., iterations = NULL) {
3939
})
4040
results <- purrr::imap(
4141
libs,
42-
~callr::r(f, libpath = .x) %>% mutate(version = .y)
42+
~ callr::r(f, libpath = .x) %>% mutate(version = .y)
4343
)
4444
as_tibble(vctrs::vec_rbind(!!!results))
4545
# %>%

0 commit comments

Comments
 (0)