# Libraries
library(dplyr)
# First value in each month
m4_daily %>%
group_by(id) %>%
condense_period(.period = "1 month")
# Last value in each month
m4_daily %>%
group_by(id) %>%
condense_period(.period = "1 month", .side = "end")
Run the code above in your browser using DataLab