I got this dataframe:
bedtime waketime
2021-01-01 21:55:00 2021-01-02 09:00:00
2021-01-02 00:15:00 2021-01-03 08:45:00
2021-01-03 01:05:00 2021-01-04 08:40:00
2021-01-04 02:01:00 2021-01-05 10:50:00
2021-01-05 00:20:00 2021-01-06 08:45:00
2021-01-06 02:25:00 2021-01-07 10:55:00
2021-01-07 00:25:00 2021-01-08 06:45:00
2021-01-08 00:10:00 2021-01-09 09:15:00
2021-01-09 00:20:00 2021-01-10 08:15:00
2021-01-10 00:00:00 2021-01-11 08:45:00
I want to change the date for the times after midnight (+ 1 day).
I did this with a different dataframe before with this code and it worked perfectly
df[hour(df$bedtime) < 12, "bedtime"] <- df$bedtime[hour(df$bedtime) < 12, "bedtime"] + (24*60*60)
But now I got the error "Incorrect number of dimensions".
I dont't know whats wrong with this dataframe, the variables have the same type than the others.
df[hour(df$bedtime) < 12, "bedtime"] <- df[hour(df$bedtime) < 12, "bedtime"] + (24*60*60)
– Ronak Shah