Removes 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.frame
of class"rwl"
, where each column is a tree-ring width series and rownames represent years.- series
A character vector specifying the names of the series (columns) to remove.
- rownames_to_years
Logical. If
TRUE
, the rownames ofx
(years) are added as a column namedyear
.- trim
Logical. If
TRUE
, leading and trailing all-NA rows are removed usingtrs_trim()
.
Value
A data.frame
with the specified series removed. If rownames_to_years = TRUE
, the result will have an additional year
column.
Examples
rwl <- trs_pseudo_rwl(n_series = 3, series_length = 60, end_date = 2000)
trs_remove(rwl, series = "trs_1")
#> trs_2 trs_3
#> 1941 96 89
#> 1942 95 86
#> 1943 105 99
#> 1944 115 103
#> 1945 106 102
#> 1946 111 105
#> 1947 123 121
#> 1948 117 114
#> 1949 127 124
#> 1950 134 119
#> 1951 139 121
#> 1952 127 114
#> 1953 130 119
#> 1954 110 104
#> 1955 103 100
#> 1956 89 92
#> 1957 90 99
#> 1958 94 95
#> 1959 96 88
#> 1960 85 83
#> 1961 79 77
#> 1962 77 85
#> 1963 93 93
#> 1964 83 87
#> 1965 88 99
#> 1966 82 97
#> 1967 83 89
#> 1968 81 85
#> 1969 86 82
#> 1970 91 84
#> 1971 87 85
#> 1972 94 88
#> 1973 86 80
#> 1974 100 99
#> 1975 97 94
#> 1976 95 88
#> 1977 94 97
#> 1978 106 109
#> 1979 102 105
#> 1980 107 114
#> 1981 105 107
#> 1982 91 97
#> 1983 103 102
#> 1984 96 102
#> 1985 90 93
#> 1986 84 95
#> 1987 73 86
#> 1988 76 93
#> 1989 72 91
#> 1990 102 109
#> 1991 100 111
#> 1992 110 118
#> 1993 101 107
#> 1994 106 115
#> 1995 95 109
#> 1996 102 111
#> 1997 106 111
#> 1998 104 109
#> 1999 103 112
#> 2000 102 100
trs_remove(rwl, series = c("trs_1", "trs_3"), rownames_to_years = TRUE)
#> trs_2 year
#> 1941 96 1941
#> 1942 95 1942
#> 1943 105 1943
#> 1944 115 1944
#> 1945 106 1945
#> 1946 111 1946
#> 1947 123 1947
#> 1948 117 1948
#> 1949 127 1949
#> 1950 134 1950
#> 1951 139 1951
#> 1952 127 1952
#> 1953 130 1953
#> 1954 110 1954
#> 1955 103 1955
#> 1956 89 1956
#> 1957 90 1957
#> 1958 94 1958
#> 1959 96 1959
#> 1960 85 1960
#> 1961 79 1961
#> 1962 77 1962
#> 1963 93 1963
#> 1964 83 1964
#> 1965 88 1965
#> 1966 82 1966
#> 1967 83 1967
#> 1968 81 1968
#> 1969 86 1969
#> 1970 91 1970
#> 1971 87 1971
#> 1972 94 1972
#> 1973 86 1973
#> 1974 100 1974
#> 1975 97 1975
#> 1976 95 1976
#> 1977 94 1977
#> 1978 106 1978
#> 1979 102 1979
#> 1980 107 1980
#> 1981 105 1981
#> 1982 91 1982
#> 1983 103 1983
#> 1984 96 1984
#> 1985 90 1985
#> 1986 84 1986
#> 1987 73 1987
#> 1988 76 1988
#> 1989 72 1989
#> 1990 102 1990
#> 1991 100 1991
#> 1992 110 1992
#> 1993 101 1993
#> 1994 106 1994
#> 1995 95 1995
#> 1996 102 1996
#> 1997 106 1997
#> 1998 104 1998
#> 1999 103 1999
#> 2000 102 2000