mksub {climate.plot} | R Documentation |
Creates a subset of a data.frame
of climate data.
mksub(dat, start, end, id, rm.id = TRUE)
dat |
climate data frame |
start |
start year; if omitted minimum year will be used |
end |
end year; if omitted will use same as start , and if start is omitted, will use maximum year |
id |
unique station identifier used to extract a subset of data from dat |
rm.id |
logical ; removes id field from dat , default is TRUE |
This utility function is useful for creating temporal subsets of climate data and for extracting a single station out of a data.frame
with multiple climate stations. The dat
object can have other fields (other than the standard set of fields), which will be returned.
If id
is used, that station will be extracted from dat
. The returned object will no longer have an id
field, unless rm.id = FASLE
. If id
is not provided, but there are more than one unique IDs in dat
, the first unique ID will be extracted, with a warning.
Returns a subset of a data.frame
with the same fields as dat
, except for id
(if it is present and rm.id = TRUE
).
M.W. Toews
data(mscstn) data(mscdata) dim(mksub(mscdata, id=1108447)) dim(mksub(mscdata, id=1108447, start=1980)) dim(mksub(mscdata, id=1108447, start=1980, end=1989))