[R] Selecting 3 different hours in a day

jck13 jennakeane at hotmail.com
Tue Nov 8 07:12:19 CET 2011


Hello,

I have a csv with 5months of hourly data for 4 years. I would like to get
9am, 12pm and 3pm from each day  and create a subset or a new data frame
that I can analyze. The time are from hour 0-23 for each day.
I am not sure how to create a loop which will take out each of these hours
and create a subset.

I was thinking of doing a for loop using the row number since:
9am= row 10
12pm= row 13
3pm= row 16

trying to loop through to extract these 3 times each day.

n=length(date_stamp)
             
for (i in i:n) {
m= 10
i= 1
new1= mv[m,]
i= i+1
m= m+3
##m+18 at row 16?
}

I need some help creating a loop through this! Thank you! 


--
View this message in context: http://r.789695.n4.nabble.com/Selecting-3-different-hours-in-a-day-tp4015010p4015010.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list