Displaying 1 result from an estimated 1 matches for "dayindex2".
Did you mean:
dayindex1
2013 Jan 12
1
How to extract value for specific rows in an array?
...pth <- array(NaN,c(nbdays,1)) # create empty array where max depth
values will be stored
Date <- array(NaN,c(nbdays,1)) # create empty array where date for max
depth values will be stored
for (i in 1:nbdays){
dayIndex1 <- samplesperday*(i-1)+1 # start of day period (value 1 of 2880)
dayIndex2 <- samplesperday*(i) # end of day period (value 2880 of 2880)
MaxDepth[i] <- max(DF$depth[dayIndex1:dayIndex2]) # extract max depth
value from the 2880 datapoints collected per day
Date [i] <- DF$date[MaxDepth[i]] ### NOT WORKING...
}
Another way to do this, since I am getting o...