ts2df | R Documentation |
Convert monthly time series vector to a year x
month data frame for
several possible subsequent analyses. Leading and trailing empty rows are
removed.
ts2df(x, mon1 = 1, addYr = FALSE, omit = FALSE)
x |
monthly time series vector |
mon1 |
starting month number, i.e., first column of the data frame |
addYr |
rows are normally labelled with the year of the starting month,
but |
omit |
if |
Our main use of ts2df
is to convert a single monthly time series into
a year x
month data frame for EOF analysis of interannual
variability.
monthCor
finds the month-to-month correlations in a monthly time
series x
. It is useful for deciding where to start the 12-month
period for an EOF
analysis (mon1
in ts2df
), namely, at
a time of low serial correlation in x
.
An n x 12
data frame, where n
is the number of years.
Alan Jassby, James Cloern
Craddock, J. (1965) A meteorological application of principal component analysis. Statistician 15, 143–156.
eof
# San Francisco Bay station 27 chlorophyll has the lowest serial
# correlation in Oct-Nov, with Sep-Oct a close second
chl27 <- sfbayChla[, 's27']
monthCor(chl27)
# Convert to a data frame with October, the first month of the
# local "water year", in the first column
tsp(chl27)
chl27 <- round(chl27, 1)
ts2df(chl27, mon1 = 10, addYr = TRUE)
ts2df(chl27, mon1 = 10, addYr = TRUE, omit = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.