Last chance! 50% off unlimited learning
Sale ends in
mydata <- selectByDate(mydata, start = "1/1/2008", end = "31/12/2008",
year = 2008, month = 1, day = "weekday", hour = 1)
date
field in hourly or
high resolution format.year = 1998:2004
to
select 1998-2004 inclusive or year = c(1998, 2004)
to select
1998 and 2004.month = 1:6
to select months 1-6 (January to June), or by
name e.g. month = c("January", "December")
. Names can be
abbreviated to 3 letters and be in lower or upperday =
c("Monday", "Wednesday")
. Names can be abbreviated to 3 letters and
be in lower or upper case. Also accepts "weekday" (Monday - Friday)
and "weekend" for convenience.hour = 0:12
to
select hours 0 to 12 inclusive.start = "1/1/1999"
means
that times are selected from hour zero. Similarly, end =
"31/12/1999"
will include all hours of the 31st December.
All options are applied in turn making it possible to select quite
complex dates## select all of 1999
data.1999 <- selectByDate(mydata, start = "1/1/1999", end = "31/12/1999")
head(data.1999)
tail(data.1999)
# easier way
data.1999 <- selectByDate(mydata, year = 1999)
# more complex use: select weekdays between the hours of 7 am to 7 pm
sub.data <- selectByDate(mydata, day = "weekday", hour = 7:19)
# select weekends between the hours of 7 am to 7 pm in winter (Dec, Jan, Feb)
sub.data <- selectByDate(mydata, day = "weekend", hour = 7:19, month =
c("dec", "jan", "feb"))
Run the code above in your browser using DataLab