Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jimrothstein committed Feb 3, 2025
1 parent 7a80dae commit d86f107
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,23 @@ iris <- as_tibble(iris) |> print()
# across() -----------------------------------------------------------------
# Different ways to select the same set of columns
# See <https://tidyselect.r-lib.org/articles/syntax.html> for details
# apply fct round to two columns specified and modify columns
iris |>
mutate(across(c(Sepal.Length, Sepal.Width), round)) |>
head()
iris
iris %>%
mutate(across(c(1, 2), round)) |>
print(n = 3)
head(n = 3)
iris %>%
mutate(across(1:Sepal.Width, round))
iris %>%
mutate(across(where(is.double) & !c(Petal.Length, Petal.Width), round))
# Using an external vector of names
# Use an external vector of names
cols <- c("Sepal.Length", "Petal.Width")
cols
iris %>%
Expand Down

0 comments on commit d86f107

Please sign in to comment.