p-park6 / eds221-day9-activities

Materials for EDS 221 Activities - Day 9
0 stars 0 forks source link

Starwars mutate fix example #1

Open p-park6 opened 1 year ago

p-park6 commented 1 year ago
 mutate(across(where(is.character), tolower))
#> Error in mutate(across(where(is.character), tolower)): could not find function "mutate"

Created on 2023-08-24 with reprex v2.0.2

p-park6 commented 1 year ago
library(tidyverse)

starwars_lower <- starwars %>% 
   mutate(across(where(is.character), tolower))

starwars_lower
#> # A tibble: 87 × 14
#>    name     height  mass hair_color skin_color eye_color birth_year sex   gender
#>    <chr>     <int> <dbl> <chr>      <chr>      <chr>          <dbl> <chr> <chr> 
#>  1 luke sk…    172    77 blond      fair       blue            19   male  mascu…
#>  2 c-3po       167    75 <NA>       gold       yellow         112   none  mascu…
#>  3 r2-d2        96    32 <NA>       white, bl… red             33   none  mascu…
#>  4 darth v…    202   136 none       white      yellow          41.9 male  mascu…
#>  5 leia or…    150    49 brown      light      brown           19   fema… femin…
#>  6 owen la…    178   120 brown, gr… light      blue            52   male  mascu…
#>  7 beru wh…    165    75 brown      light      blue            47   fema… femin…
#>  8 r5-d4        97    32 <NA>       white, red red             NA   none  mascu…
#>  9 biggs d…    183    84 black      light      brown           24   male  mascu…
#> 10 obi-wan…    182    77 auburn, w… fair       blue-gray       57   male  mascu…
#> # ℹ 77 more rows
#> # ℹ 5 more variables: homeworld <chr>, species <chr>, films <list>,
#> #   vehicles <list>, starships <list>

Created on 2023-08-24 with reprex v2.0.2