Lubridate yday starting day1 in the middle of the year?
9 views
Skip to first unread message
Meghan Sauro
unread,
Nov 26, 2020, 7:45:29 PM11/26/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lubridate
Hi everyone! I need help. Im new to R and I have a hydrometric project working with water (discharge) data. I need my year to actually go from July to June not January to December, so how do I tell r using Lubridate that my yday #1 needs to start in July? I need to be able to take annual averages from my daily data.
Any help is much appreciated!
Meghan
Shivam Shrotriya
unread,
Jan 6, 2023, 12:03:35 PM1/6/23
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
day_vec <- seq(as.Date("2020-07-01"), as.Date("2021-06-30"), by = "days")
day_vec2 <- day_vec %m-% months(6) #Substracting because the new year will start 6 months later
yday(day_vec2) #New dates will have the desired yday.
The point to keep in mind is whether your new beginning of the year is before or after the conventional beginning. If your year starts early, you should add months and vice-versa.