EcoQuestions
EcoQuestions

Reputation: 11

Getting a Day Number of the Year, while IGNORING leap years days (1-365, repeated)

I'm trying to get day number of the year to take an average of EVERY Jan. 1, Jan. 2, etc etc.

To do this Im trying to set up day numbers 1-365 repeated throughout the data frame for the multiple years.

I'm sure there are multiple ways to do this, but I'm getting a little stuck.

So far I've tried yday(df$Date) but it tries to add 366 days for leap years. I've removed ALL leap days from my data set, so this turns out false.

Any advice on how to proceed?

Upvotes: 0

Views: 122

Answers (1)

EcoQuestions
EcoQuestions

Reputation: 11

I think I figured it out

df$DayNumber <- rep(c(1:365), times = #YEARAMOUNT) 

I'm sure there is a more elegant way that actually ties together the date and day number directly... but it seemed to work for my purposes.

Upvotes: 0

Related Questions