0
I need to calculate the maximum consumption value based on the previous values each time I loop the consumption data. For example on day 4, the maximum consumption would be calculated from day 1 to 4.
Follow the code I thought, but I don’t know how it can be calculated
Maxconsumo<-c()
for (i in 1:length(Consumo)) {
Maxconsumo <- .........
}
Dia Consumo
1 245
2 256
3 300
4 450
5 245
6 256
7 300
8 450
Thank you very much!!
– Luciano Hauschild
You’re welcome! If it was helpful, you can accept and validate the answer.
– Willian Vieira
Sure! Sorry I’m new here, as I do to accept and validate your answers?
– Luciano Hauschild
https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta
– Willian Vieira