I have a dataframe with some values per time.
library(flux)
library(dplyr)
library(lubridate)
mydf <- tibble(mydate = as.Date(c("2019-05-11 23:55:00", "2019-05-11 23:56:00", "2019-05-11 23:57:00", "2019-05-11 23:58:00",
"2019-05-12 23:55:00", "2019-05-12 23:56:00", "2019-05-12 23:57:00", "2019-05-12 23:58:00")),
myval = c(101.23, 102.34, 105.43, 106.7, 107.1, 108.2, 109.2, 110.1))
I want to find auc per day. So, I am trying:
mydf <- mydf %>%
group_by(day = floor_date(mydate, "day")) %>%
summarise(Valmean = mean(myval, na.rm = TRUE),
perDayIntegr = auc(time(day), Valmean))
and I am receiving:
Error in seq.default(x[1], x[2], length.out = dens) :
'to' must be a finite number
UPDATE:
If I use this dataset:
mydf <- tibble(mydate = as.Date(c("2019-05-11 23:55:00", "2019-05-11 23:56:00", "2019-05-11 23:57:00", "2019-05-11 23:58:00",
"2019-05-12 23:55:00", "2019-05-12 23:56:00", "2019-05-12 23:57:00", "2019-05-12 23:58:00",
"2019-05-13 23:55:00", "2019-05-13 23:56:00", "2019-05-13 23:57:00", "2019-05-14 23:58:00")),
myval = c(101.23, 102.34, 105.43, 106.7, 107.1, 108.2, 109.2, 110.1, 111, 112, 113, 114))
where in the last line I am using only one row for date "2019-05-14 23:58:00"
it still gives me the error.