10.31 Subset of Rows Within Groups
20200814 The dplyr::slice() command understands
groups and so the indicies supplied will apply to each group. To
select, for example, the second row of each group, simply supply
2 as the argument. Notice the rows selected are all on the
second of the month.
## # A tibble: 49 × 24
## # Groups: location [49]
## date location min_temp max_temp rainfall evaporation sunshine
## <date> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2008-07-02 Adelaide 12.7 15.8 0.8 1.4 7.8
## 2 2008-12-02 Albany 14.7 21 0 5.4 9.1
## 3 2008-12-02 Albury 7.4 25.1 0 4.8 8.5
## 4 2008-12-02 AliceSprings 21 39.1 1.2 9 12.2
## 5 2009-01-02 BadgerysCreek 14.7 26.1 0 4.8 8.5
## 6 2008-12-02 Ballarat 4.3 19.5 0.4 4.8 8.5
## 7 2008-12-02 Bendigo 6.2 23 0 8.8 8.5
## 8 2008-07-02 Brisbane 8.1 22.9 0 2 9.8
## 9 2008-12-02 Cairns 24.2 32.3 8.4 6.6 5.3
## 10 2007-11-02 Canberra 14 26.9 3.6 4.4 9.7
## # ℹ 39 more rows
## # ℹ 17 more variables: wind_gust_dir <ord>, wind_gust_speed <dbl>,
## # wind_dir_9am <ord>, wind_dir_3pm <ord>, wind_speed_9am <dbl>,
## # wind_speed_3pm <dbl>, humidity_9am <int>, humidity_3pm <int>,
## # pressure_9am <dbl>, pressure_3pm <dbl>, cloud_9am <int>, cloud_3pm <dbl>,
## # temp_9am <dbl>, temp_3pm <dbl>, rain_today <fct>, risk_mm <dbl>,
## # rain_tomorrow <fct>
If you find this curated material useful then you can consider a donation to support it's ongoing availability and give you access to the PDF version of this book. The material has been scoped up by Generative AI without permission or any kind of recompense so do consider a donation if you can afford it. Unlike Generative AI your access to this materials is freely given. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Togaware has a 30 year tradition of making popular open source software which includes sold privacy preserving productivity apps, rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0