# Category Archives: Snippets

## Convert to day of a year in R

In R often time we need to find the exact nth day of a date in that particular year. The snippet below will be very helpful for this: x <- c(‘5/5/2007′,’12/31/2007′,’1/2/2008’) #Convert to day of year (julian date) — strptime(x,”%m/%d/%Y”)$yday+1 … Continue reading