[R] pick time intervalls

Wayne.W.Jones at shell.com Wayne.W.Jones at shell.com
Thu Sep 13 11:42:53 CEST 2007


?tapply

temp.data<-data[as.character(data$time %in% c("02:00","03:00","04:00"),] 
# one quick and dirty method is to create a subset the data , not sure what format your time data is so converted to character strings.

then something like: 

tapply(temp.data$V1, factor(temp.data$time), mean) 

Wayne


-----Original Message-----
From: r-help-bounces at r-project.org
[mailto:r-help-bounces at r-project.org]On Behalf Of jerzack
Sent: 13 September 2007 10:26
To: r-help at stat.math.ethz.ch
Subject: [R] pick time intervalls



Hello,
as an R beginner I have a question concerning the following data set:

nr     date       time    V1  V2  V3  V4  V5  V6
...
2828 26/08/05 20:00  60  38  55  58  53  56
2829 26/08/05 21:00  58  34  54  49  45  53
2830 26/08/05 22:00  56  35  52  51  46  47
2831 26/08/05 23:00  56  35  50  45  46  38
2832 27/08/05 00:00  61  34  49  42  47  32
2833 27/08/05 01:00  62  38  52  49  48  36
2834 27/08/05 02:00  64  39  51  49  50  42
2835 27/08/05 03:00  63  40  49  46  49  33
2836 27/08/05 04:00  58  37  47  48  51  20
...

How can I access values at a certain time intervall every day.
For example I would like to calculate the mean of the V1 values for the
times 02:00 - 04:00 every day.
Thank you very much for your help!
jeremy
-- 
View this message in context: http://www.nabble.com/pick-time-intervalls-tf4434604.html#a12651552
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list