Couis
Couis

Reputation: 1

Create multiples dates list for each level of a factor

I would like to create a data frame that would include a date list replicated by the levels of a factor. I can create the list pretty easily

lst_dates<-as.data.frame(seq(as.Date("2024-05-07"), as.Date("2024-09-01"), by="days")).
lst_dates <- lst_dates %>% 
  rename(Date_nuit = 1)

I would like to replicate this list by 37 times which is the number of levels of my factor of my df$Lieu. The name of the level of this factor would be added in a new column in my lst_date.

enter image description here

Thx for your help!

Upvotes: 0

Views: 23

Answers (0)

Related Questions