Skip to content
Prev 349880 / 398506 Next

Finding values in a dataframe at a specified hour

Hi Alexandra,
I answered too quickly. Your response made me look for a deeper error: The
value of i doesn't matter, as it isn't being used as an index. However, the
first value of i=0 may cause the error in the second loop, where h is used
as an index.

for (i in 0:23){
  hourRow = which(windHW$hour==i,arr.ind=TRUE)
  for (h in hourRow){
    if (windHW[h+1,1]>=spring[spring$hour==i,5]){
      windHW[h+1,1]<-NA}
  }
}

Jim
On Sat, Apr 11, 2015 at 9:24 AM, Alexandra Catena <amc5981 at gmail.com> wrote: