'How to get hourly data values stored in a data frame that is used to derive another data frame composed of its week no

#hourlydataset in mz matrix

##then I created another data frame of daily values further, I am trying to read the daily value data frame in rows and storing the 24 hours values based on 'did'

 for (i in 1:length(id3)) {
  idfinal2<-id3[i]
  yrn<-df2[idfinal2,1]
  wkn<-df2[idfinal2,2]
  did<-(((yrn-1))*8760)+(wkn*24)
  dtk<-mz[(did+1):(did+24),ensm]
  hrdat<-rbind(hrdat,dtk)
}

#it is giving NAn error at wkn but reading yrn fine!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source