
Assign calendar years to tree-ring series in an rwl-style data frame
Source:R/trs_end_date.R
trs_end_date.Rd
Sets the row names (years) of an rwl-style data frame based on a specified end year.
Optionally trims trailing rows with only NA
values.
Arguments
- x
A
data.frame
of class"rwl"
, with each column representing a tree-ring series.- end_year
An integer. The calendar year assigned to the most recent tree ring (last row).
- trim
Logical. If
TRUE
, the data frame is trimmed to remove leading and trailing rows with no data (seetrs_trim
).
Examples
rwl <- trs_pseudo_rwl(n_series = 2, series_length = 50)
trs_end_date(rwl, end_year = 2000)
#> End date set for all series in x
#> trs_1 trs_2
#> 1951 114 115
#> 1952 118 114
#> 1953 115 110
#> 1954 92 96
#> 1955 96 101
#> 1956 100 107
#> 1957 90 98
#> 1958 94 96
#> 1959 96 91
#> 1960 97 86
#> 1961 78 75
#> 1962 80 71
#> 1963 81 79
#> 1964 91 84
#> 1965 93 82
#> 1966 102 100
#> 1967 101 98
#> 1968 99 101
#> 1969 107 103
#> 1970 103 93
#> 1971 114 109
#> 1972 103 101
#> 1973 113 106
#> 1974 103 100
#> 1975 88 87
#> 1976 91 84
#> 1977 97 95
#> 1978 107 105
#> 1979 106 101
#> 1980 114 105
#> 1981 111 97
#> 1982 102 88
#> 1983 91 74
#> 1984 105 97
#> 1985 108 101
#> 1986 93 99
#> 1987 105 109
#> 1988 96 98
#> 1989 91 92
#> 1990 88 87
#> 1991 92 91
#> 1992 77 82
#> 1993 88 96
#> 1994 90 97
#> 1995 92 94
#> 1996 97 92
#> 1997 89 83
#> 1998 102 95
#> 1999 101 94
#> 2000 93 83
trs_end_date(rwl, end_year = 2000, trim = TRUE)
#> End date set for all series in x
#> trs_1 trs_2
#> 1951 114 115
#> 1952 118 114
#> 1953 115 110
#> 1954 92 96
#> 1955 96 101
#> 1956 100 107
#> 1957 90 98
#> 1958 94 96
#> 1959 96 91
#> 1960 97 86
#> 1961 78 75
#> 1962 80 71
#> 1963 81 79
#> 1964 91 84
#> 1965 93 82
#> 1966 102 100
#> 1967 101 98
#> 1968 99 101
#> 1969 107 103
#> 1970 103 93
#> 1971 114 109
#> 1972 103 101
#> 1973 113 106
#> 1974 103 100
#> 1975 88 87
#> 1976 91 84
#> 1977 97 95
#> 1978 107 105
#> 1979 106 101
#> 1980 114 105
#> 1981 111 97
#> 1982 102 88
#> 1983 91 74
#> 1984 105 97
#> 1985 108 101
#> 1986 93 99
#> 1987 105 109
#> 1988 96 98
#> 1989 91 92
#> 1990 88 87
#> 1991 92 91
#> 1992 77 82
#> 1993 88 96
#> 1994 90 97
#> 1995 92 94
#> 1996 97 92
#> 1997 89 83
#> 1998 102 95
#> 1999 101 94
#> 2000 93 83