Extracts one or more tree-ring series (columns) from a data frame of class "rwl".
Optionally adds the rownames (assumed to be years) as a column.
Arguments
- x
A
data.frameof class"rwl", where each column is a tree-ring width series and rownames represent years.- series
A character string or vector specifying the name(s) of the series (columns) to extract.
- trim
Logical. If
TRUE, leading and trailing all-NA rows are removed usingtrs_trim().
Value
A data.frame with the selected series.If trim = TRUE, leading and trailing all-NA rows are removed.
If a single series is selected, returns a single-column data frame.
Examples
rwl <- trs_pseudo_rwl(n_series = 5, series_length = 60, end_date = 2000)
# Select single series
trs_select(rwl, series = "trs_1", trim = TRUE)
#> trs_1
#> 1941 88
#> 1942 91
#> 1943 91
#> 1944 91
#> 1945 98
#> 1946 103
#> 1947 106
#> 1948 97
#> 1949 101
#> 1950 99
#> 1951 96
#> 1952 93
#> 1953 90
#> 1954 96
#> 1955 102
#> 1956 94
#> 1957 98
#> 1958 96
#> 1959 100
#> 1960 106
#> 1961 116
#> 1962 135
#> 1963 119
#> 1964 108
#> 1965 111
#> 1966 111
#> 1967 117
#> 1968 113
#> 1969 114
#> 1970 104
#> 1971 106
#> 1972 90
#> 1973 89
#> 1974 72
#> 1975 79
#> 1976 88
#> 1977 94
#> 1978 91
#> 1979 98
#> 1980 103
#> 1981 96
#> 1982 102
#> 1983 105
#> 1984 94
#> 1985 110
#> 1986 95
#> 1987 92
#> 1988 90
#> 1989 97
#> 1990 91
#> 1991 103
#> 1992 110
#> 1993 94
#> 1994 98
#> 1995 89
#> 1996 92
#> 1997 92
#> 1998 102
#> 1999 108
#> 2000 100
# Select multiple series
trs_select(rwl, series = c("trs_1", "trs_2"), trim = TRUE)
#> trs_1 trs_2
#> 1941 88 75
#> 1942 91 84
#> 1943 91 85
#> 1944 91 88
#> 1945 98 97
#> 1946 103 98
#> 1947 106 100
#> 1948 97 88
#> 1949 101 85
#> 1950 99 98
#> 1951 96 99
#> 1952 93 104
#> 1953 90 104
#> 1954 96 99
#> 1955 102 104
#> 1956 94 98
#> 1957 98 102
#> 1958 96 99
#> 1959 100 96
#> 1960 106 103
#> 1961 116 110
#> 1962 135 121
#> 1963 119 116
#> 1964 108 105
#> 1965 111 100
#> 1966 111 106
#> 1967 117 101
#> 1968 113 115
#> 1969 114 122
#> 1970 104 122
#> 1971 106 112
#> 1972 90 98
#> 1973 89 92
#> 1974 72 73
#> 1975 79 88
#> 1976 88 84
#> 1977 94 89
#> 1978 91 96
#> 1979 98 100
#> 1980 103 101
#> 1981 96 96
#> 1982 102 98
#> 1983 105 98
#> 1984 94 87
#> 1985 110 94
#> 1986 95 89
#> 1987 92 91
#> 1988 90 90
#> 1989 97 97
#> 1990 91 90
#> 1991 103 97
#> 1992 110 103
#> 1993 94 91
#> 1994 98 104
#> 1995 89 95
#> 1996 92 102
#> 1997 92 97
#> 1998 102 101
#> 1999 108 104
#> 2000 100 101
trs_select(rwl, series = c("trs_1", "trs_3", "trs_5"))
#> trs_1 trs_3 trs_5
#> 1941 88 91 87
#> 1942 91 101 93
#> 1943 91 101 89
#> 1944 91 99 90
#> 1945 98 107 92
#> 1946 103 102 99
#> 1947 106 105 100
#> 1948 97 94 95
#> 1949 101 106 94
#> 1950 99 98 87
#> 1951 96 95 84
#> 1952 93 90 96
#> 1953 90 90 99
#> 1954 96 101 99
#> 1955 102 108 105
#> 1956 94 89 92
#> 1957 98 98 101
#> 1958 96 91 100
#> 1959 100 95 99
#> 1960 106 100 103
#> 1961 116 108 112
#> 1962 135 121 122
#> 1963 119 106 110
#> 1964 108 95 102
#> 1965 111 103 104
#> 1966 111 112 113
#> 1967 117 107 109
#> 1968 113 118 119
#> 1969 114 117 117
#> 1970 104 109 110
#> 1971 106 105 104
#> 1972 90 90 95
#> 1973 89 88 92
#> 1974 72 77 76
#> 1975 79 92 89
#> 1976 88 85 89
#> 1977 94 88 88
#> 1978 91 96 87
#> 1979 98 104 96
#> 1980 103 104 96
#> 1981 96 98 92
#> 1982 102 94 88
#> 1983 105 100 96
#> 1984 94 92 89
#> 1985 110 92 95
#> 1986 95 85 86
#> 1987 92 90 94
#> 1988 90 83 91
#> 1989 97 95 103
#> 1990 91 86 94
#> 1991 103 100 105
#> 1992 110 99 103
#> 1993 94 97 97
#> 1994 98 101 115
#> 1995 89 108 101
#> 1996 92 119 98
#> 1997 92 120 100
#> 1998 102 118 109
#> 1999 108 117 113
#> 2000 100 107 107
