Extract fhx observations for given years

get_year(x, yr)

Arguments

x

An fhx object.

yr

Numeric vector of year(s) to extract from x.

Value

An fhx object.

See also

Examples

data(lgr2)
get_year(lgr2, 1806)
#>     year series      rec_type
#> 423 1806  LGR46    dormant_fs
#> 468 1806  LGR41    unknown_fi
#> 550 1806  LGR52    unknown_fi
#> 629 1806  LGR51 recorder_year
#> 676 1806  LGR45    unknown_fi
#> 683 1806  LGR49    unknown_fs
#> 705 1806  LGR53      early_fs
#> 744 1806  LGR43      early_fs

get_year(lgr2, 1805:1807)
#>     year series      rec_type
#> 422 1805  LGR46 recorder_year
#> 423 1806  LGR46    dormant_fs
#> 424 1807  LGR46 recorder_year
#> 468 1806  LGR41    unknown_fi
#> 469 1807  LGR41 recorder_year
#> 549 1805  LGR52 recorder_year
#> 550 1806  LGR52    unknown_fi
#> 551 1807  LGR52 recorder_year
#> 628 1805  LGR51 recorder_year
#> 629 1806  LGR51 recorder_year
#> 630 1807  LGR51 recorder_year
#> 676 1806  LGR45    unknown_fi
#> 677 1807  LGR45 recorder_year
#> 683 1806  LGR49    unknown_fs
#> 684 1807  LGR49 recorder_year
#> 705 1806  LGR53      early_fs
#> 706 1807  LGR53 recorder_year
#> 744 1806  LGR43      early_fs
#> 745 1807  LGR43 recorder_year

if (FALSE) {
# Subsetting before/after a specific year requires a
# call to year_range(). For example, to extract all observations
# prior to 1900, use
get_year(lgr2, year_range(lgr2)[1]:1900)
}