![]() ![]() by_group = TRUE ) %>% relocate ( species, mass ) #> # A tibble: 87 × 14 #> # Groups: species #> species mass name height hair_…¹ skin_…² eye_c…³ birth…⁴ sex gender #> #> 1 Aleena 15 Ratt… 79 none grey, … unknown NA male mascu… #> 2 Besalisk 102 Dext… 198 none brown yellow NA male mascu… #> 3 Cerean 82 Ki-A… 198 white pale yellow 92 male mascu… #> 4 Chagrian NA Mas … 196 none blue blue NA male mascu… #> # … with 83 more rows, 4 more variables: homeworld, films, #> # vehicles, starships, and abbreviated variable names #> # ¹hair_color, ²skin_color, ³eye_color, ⁴birth_year The sort argument is useful if you want to see the largest groups up front.īy_species %>% arrange ( desc ( mass ) ) %>% relocate ( species, mass ) #> # A tibble: 87 × 14 #> # Groups: species #> species mass name height hair_…¹ skin_…² eye_c…³ birth…⁴ sex gender #> #> 1 Hutt 1358 Jabba… 175 NA green-… orange 600 herm… mascu… #> 2 Kaleesh 159 Griev… 216 none brown,… green,… NA male mascu… #> 3 Droid 140 IG-88 200 none metal red 15 none mascu… #> 4 Human 136 Darth… 202 none white yellow 41.9 male mascu… #> # … with 83 more rows, 4 more variables: homeworld, films, #> # vehicles, starships, and abbreviated variable names #> # ¹hair_color, ²skin_color, ³eye_color, ⁴birth_year by_species %>% arrange ( desc ( mass ). ![]() Or use tally() to count the number of rows in each group. By_species #> # A tibble: 87 × 14 #> # Groups: species #> name height mass hair_…¹ skin_…² eye_c…³ birth…⁴ sex gender homew…⁵ #> #> 1 Luke … 172 77 blond fair blue 19 male mascu… Tatooi… #> 2 C-3PO 167 75 NA gold yellow 112 none mascu… Tatooi… #> 3 R2-D2 96 32 NA white,… red 33 none mascu… Naboo #> 4 Darth… 202 136 none white yellow 41.9 male mascu… Tatooi… #> # … with 83 more rows, 4 more variables: species, films, #> # vehicles, starships, and abbreviated variable names #> # ¹hair_color, ²skin_color, ³eye_color, ⁴birth_year, ⁵homeworld by_sex_gender #> # A tibble: 87 × 14 #> # Groups: sex, gender #> name height mass hair_…¹ skin_…² eye_c…³ birth…⁴ sex gender homew…⁵ #> #> 1 Luke … 172 77 blond fair blue 19 male mascu… Tatooi… #> 2 C-3PO 167 75 NA gold yellow 112 none mascu… Tatooi… #> 3 R2-D2 96 32 NA white,… red 33 none mascu… Naboo #> 4 Darth… 202 136 none white yellow 41.9 male mascu… Tatooi… #> # … with 83 more rows, 4 more variables: species, films, #> # vehicles, starships, and abbreviated variable names #> # ¹hair_color, ²skin_color, ³eye_color, ⁴birth_year, ⁵homeworld
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |