inst2daily | R Documentation |
Given a data.frame or matrix, keeps rows which correspond to the maximum for each level of indFac.
inst2daily(zz, indFac, indVec)
zz |
the dataset of matrix whcih should be processed |
indFac |
the column number which identifies the grouping column.
The column doesn't need to be a factor ( |
indVec |
the column number which identifies the variable of interest column. |
As the name betrays this was built to process 15-minutes data and identify daily maxima. It still work to extract monthly or annual maxima.
an object of the same class and size as zz, in which only values which are the maximum value for the indVec column in the indFac groups are kept.
set.seed(145)
zz <- data.frame(month = c(rep("Jan",5),rep("Feb",5),rep("Mar",5),rep("Apr",5)),
flow = rnorm(20,50,6),
day=rep(c(2,9,16,23,28),4))
inst2daily(zz, indVec=2, indFac = 1)
zz$month <- factor(zz$month, levels = c("Jan","Feb","Mar","Apr"), ordered = TRUE)
inst2daily(zz, indVec=2, indFac = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.