kdd.from.raw.data {FeedbackTS} | R Documentation |
Build a KDD (Key Day Dataset) object from a matrix or a data frame containing a time series and other attributes.
kdd.from.raw.data(raw.data, keyday.threshold, nb.days, col.series, col.date,
na.rm = TRUE, filter = NULL)
raw.data |
a data frame or a matrix containing raw data. |
keyday.threshold |
a numeric providing the threshold value above which a day is considered as a key day (i.e. if the value |
nb.days |
an integer specifying the number of days considered after and before each key day. |
col.series |
an integer specifying the number of the column containing the time series. |
col.date |
an integer vector of size three specifying the numbers of the columns containing the vector of years, the vector of months and the vector of days in numeric format. |
na.rm |
a logical indicating whether key days |
filter |
a list of lists specifying the filters to carry out over the time series (default is |
The filter
argument is a list of lists, each list having the following arguments:
apply.over
:a character string that must be one of "keyday" or "range", and that indicates whether the filter concerns only the key days or also the range of days considered around the key days (K
days before and K
days after each key day).
column
:an integer specifying the column of raw.data
which the filter is applied to.
value
:a value that must be taken by the variable determined by the argument column
.
Let i
denote a key day. Let z_i
denote the value, at day i
, of the variable determined by the argument column
. If apply.over = "keyday"
and z_i
= value
, then key day i
is kept, otherwise it is discarded. If apply.over = "range"
and z_j
= value
for all j\in\{i-K,\ldots,i+K\}
, then key day i
is kept, otherwise it is discarded.
an object from the KDD class.
Samuel Soubeyrand Samuel.Soubeyrand@avignon.inra.fr, Cindy E. Morris, E. Keith Bigg.
Soubeyrand, S., Morris, C. E. and Bigg, E. K. (2014). Analysis of fragmented time directionality in time series to elucidate feedbacks in climate data. Environmental Modelling and Software 61: 78-86.
#### load data for site 6008 (Callagiddy station)
data(rain.site.6008)
#### build KDD objects from raw data (site 6008: Callagiddy station)
## using a threshold value equal to 25
KDD=kdd.from.raw.data(raw.data=rain.site.6008,keyday.threshold=25,nb.days=20,
col.series=5,col.date=c(2,3,4),na.rm=TRUE,filter=NULL)
summary(KDD)
#### build KDD objects from raw data (site 6008: Callagiddy station)
## using a threshold value equal to 25
## using filters
rain.site.6008b=cbind(rain.site.6008,rain.site.6008[["Year"]]>=1960)
KDD2=kdd.from.raw.data(raw.data=rain.site.6008b,keyday.threshold=25,nb.days=20,
col.series=5,col.date=c(2,3,4),na.rm=TRUE,
filter=list(list(apply.over="range",column=6,value=TRUE)))
summary(KDD2)