I'd like to expand my dataframe by repeating a row 24 times while adding an additional column for "hour". Here is an example of my data:
set.seed(1)
mydata <- data.frame(Tmin = sample(0:3), Tmax = sample(4:7), Day = rep(1:4))
I want to expand this table such that each row is repeated with the same Tmin, Tmax, and Day 24 times, with an additional column mydata$hour
where the numbers 1:24 are repeated for each day. All other values (Tmin, Tmax, Day) stay the same for each row. Thanks!