library(timeDF)
time_df = data.frame(
time = c("2023-01-01 12:00:00",
"2023-01-21 12:00:00",
"2023-02-10 12:00:00",
"2023-03-02 12:00:00",
"2023-03-22 12:00:00",
"2023-04-11 12:00:00"
),
value = c(123, 144, 150, 100, 130, 145)
)
timeDF = as.timeDF(time_df)
period_df = data.frame(
start = c("2023-01-01",
"2023-03-01"),
end = c("2023-01-31",
"2023-03-31")
)
periodDF = as.periodDF(period_df, "date")
extract_with_periodDF(timeDF, periodDF, "both")
Run the code above in your browser using DataLab