Skip to content

Commit

Permalink
replaced ifelse() with the tidyverse if_else() in the wrangling l…
Browse files Browse the repository at this point in the history
…esson
  • Loading branch information
angelchen7 committed Jun 11, 2024
1 parent 73211dc commit 4630b6f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions materials/sections/clean-wrangle-data.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,11 @@ We just ran through the various things we can do with `dplyr` and `tidyr` but if
```{r}
#| catch: true
#| message: false
catch_original <- read_csv(url("https://knb.ecoinformatics.org/knb/d1/mn/v2/object/df35b.302.1",
method = "libcurl"))
catch_original <- read_csv("https://knb.ecoinformatics.org/knb/d1/mn/v2/object/df35b.302.1")
mean_region <- catch_original %>%
select(-All, -notesRegCode) %>%
mutate(Chinook = ifelse(Chinook == "I", 1, Chinook)) %>%
mutate(Chinook = if_else(Chinook == "I", "1", Chinook)) %>%
mutate(Chinook = as.numeric(Chinook)) %>%
pivot_longer(-c(Region, Year),
names_to = "species",
Expand Down

0 comments on commit 4630b6f

Please sign in to comment.