Skip to content

Commit

Permalink
Reformat again with better hugging and ~ behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Feb 20, 2025
1 parent 3b015a0 commit 4a4a1b0
Show file tree
Hide file tree
Showing 17 changed files with 206 additions and 198 deletions.
2 changes: 1 addition & 1 deletion R/data-mask.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ DataMask <- R6Class(
# reference is "fresh" and completely owned by this instance of the
# `DataMask`. Otherwise nested `mutate()` calls can end up modifying
# the same value (#6762).
private$env_current_group_info <- new_environment(data = list(
private$env_current_group_info <- new_environment(list(
`dplyr:::current_group_id` = duplicate(0L),
`dplyr:::current_group_size` = duplicate(0L)
))
Expand Down
10 changes: 4 additions & 6 deletions data-raw/starwars.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,9 @@ starwars %>% count(sex, gender, sort = TRUE)

# see https://github.com/tidyverse/dplyr/pull/6840
starwars = starwars %>%
mutate(name = ifelse(
name == "Beru Whitesun lars",
"Beru Whitesun Lars",
name
))
mutate(
name = ifelse(name == "Beru Whitesun lars", "Beru Whitesun Lars", name)
)

# Basic checks -------------------------------------------------------------

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

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

usethis::use_data(starwars, overwrite = TRUE)
32 changes: 18 additions & 14 deletions data-raw/storms.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,17 @@ storms <- storms %>%

# hurricane category
storms <- storms %>%
mutate(category = case_when(
status != "hurricane" ~ NA,
wind >= 137 ~ 5,
wind >= 113 ~ 4,
wind >= 96 ~ 3,
wind >= 83 ~ 2,
wind >= 64 ~ 1,
.default = NA
)) %>%
mutate(
category = case_when(
status != "hurricane" ~ NA,
wind >= 137 ~ 5,
wind >= 113 ~ 4,
wind >= 96 ~ 3,
wind >= 83 ~ 2,
wind >= 64 ~ 1,
.default = NA
)
) %>%
relocate(category, .after = status)

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

# make names Title casing
storms <- storms %>%
mutate(name = if_else(
str_sub(name, 1, 3) %in% c("AL0", "AL1"),
name,
str_to_title(name)
))
mutate(
name = if_else(
str_sub(name, 1, 3) %in% c("AL0", "AL1"),
name,
str_to_title(name)
)
)

# drop a bad data point (add more if found)
storms <- storms %>%
Expand Down
2 changes: 1 addition & 1 deletion inst/bench/bench.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ benchs <- function(libs, setup, ..., iterations = NULL) {
})
results <- purrr::imap(
libs,
~callr::r(f, libpath = .x) %>% mutate(version = .y)
~ callr::r(f, libpath = .x) %>% mutate(version = .y)
)
as_tibble(vctrs::vec_rbind(!!!results))
# %>%
Expand Down
Loading

0 comments on commit 4a4a1b0

Please sign in to comment.