It's much easier to use xts' time-of-day subsetting:
library(xts)
dat1 <- as.xts(read.zoo(text="TIME, Value1, Value2
01.08.2011 02:30:00, 4.4, 4.7
01.09.2011 03:00:00, 4.2, 4.3
01.11.2011 01:00:00, 3.5, 4.3
01.12.2011 01:40:00, 3.4, 4.5
01.01.2012 02:00:00, 4.8, 5.3
01.02.2012 02:30:00, 4.9, 5.2
0
HI Jakob,
If your data is based on 30 min interval, this should work:
dat1<-read.table(text="
TIME, Value1, Value2
01.08.2011 02:30:00, 4.4, 4.7
01.09.2011 03:00:00, 4.2, 4.3
01.11.2011 01:00:00, 3.5, 4.3
01.12.2011 01:40:00, 3.4, 4.5
01.01.2012 02:00:00, 4.8, 5.3
01.02.2012 02:30:00, 4.9,
Hi,
Try this:
z1[seq(which(time(z1)==as.POSIXct("01.01.2012 02:00:00",format="%d.%m.%Y
%H:%M:%S")),which(time(z1)==as.POSIXct("01.01.2013 03:00:00",format="%d.%m.%Y
%H:%M:%S"))),]
# Value1 Value2
#2012-01-01 02:00:00 4.8 5.3
#2012-02-01 02:30:00 4.9 5.2
#2012-08
Hi Jakob,
dat1<-read.table(text="
TIME, Value1, Value2
01.08.2011 02:30:00, 4.4, 4.7
01.09.2011 03:00:00, 4.2, 4.3
01.11.2011 01:00:00, 3.5, 4.3
01.12.2011 01:40:00, 3.4, 4.5
01.01.2012 02:00:00, 4.8, 5.3
01.02.2012 02:30:00, 4.9, 5.2
01.08.2012 02:30:00, 4.1, 4.7
01.12.2012 03:00:00, 4.
4 matches
Mail list logo