SRtrend5 | R Documentation |
Calculate the five-year linear trend of a time series of data, by the specified grouping variables.
SRtrend5(df, x, group, time, lasttime = NULL)
df |
A data frame containing the data to be averaged. |
x |
A character scalar, naming the element of |
group |
A character scalar, naming the element of |
time |
A character scalar, naming the element of |
lasttime |
A numeric scalar, the last value of time that should be used to calculate
the trend. The default, NULL, results in |
A data frame with one row per group and last time, giving the intercept (Y.5nt), slope (Y.5sl), and P value (Y.5pv) for the five-year linear trend.
rawdat <- data.frame( Year = 1990 + c(0:5, 8:9, 2:3, 5:8), Type = rep(1:2, c(8, 6)), Y = c(1:12, 9, 7)*10 ) SRtrend5(rawdat, "Y", "Type", "Year") SRtrend5(rawdat, "Y", "Type", "Year", lasttime=1995)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.