# A tibble: 5,982 × 8
data_code rec_year rec_month rec_day animal_code animal_sex animal_weight
<chr> <dbl> <dbl> <dbl> <chr> <chr> <dbl>
1 CBH01 1994 11 8 813 F 890
2 CBH01 1994 11 8 B-905 F 828
3 CBH01 1994 11 8 B-909 F 812
4 CBH01 1994 11 8 W-008 F 884
5 CBH01 1994 11 8 910 M 982
6 CBH01 1994 11 8 91C M 1020
7 CBH01 1994 11 8 91F M 1050
8 CBH01 1994 11 8 91H M 1037
9 CBH01 1994 11 8 91J M 1104
10 CBH01 1994 11 8 91K M 1306
# ℹ 5,972 more rows
# ℹ 1 more variable: animal_yob <dbl>
Pipes
You can use pipes for finer control of multiple comparisons.
The below command carries out the following filtering steps in order:
Extract females.
Extract observations with animal weight between 900 and 1100.
Extract samples from the year 2000.
bison_tbl |>#Filter to retain females dplyr::filter(animal_sex =="F") |>#Filter to retain samples with animal_weight between 900 and 1100 dplyr::filter(animal_weight >900& animal_weight <1000) |>#Retain samples from year 2000 dplyr::filter(rec_year ==2000)
# A tibble: 39 × 8
data_code rec_year rec_month rec_day animal_code animal_sex animal_weight
<chr> <dbl> <dbl> <dbl> <chr> <chr> <dbl>
1 CBH01 2000 11 16 A11 F 976
2 CBH01 2000 11 16 A14 F 930
3 CBH01 2000 11 16 A16 F 952
4 CBH01 2000 11 16 A17 F 964
5 CBH01 2000 11 16 A18 F 904
6 CBH01 2000 11 16 A2 F 910
7 CBH01 2000 11 16 A22 F 992
8 CBH01 2000 11 16 A27 F 970
9 CBH01 2000 11 16 A28 F 902
10 CBH01 2000 11 16 A6 F 992
# ℹ 29 more rows
# ℹ 1 more variable: animal_yob <dbl>