Transform Date Object to Julian Day in R (Example Code)
In this R tutorial you’ll learn how to transform a date object to a Julian day.
Creating Example Data
x <- as.Date("2024-08-12") # Example date object x # [1] "2024-08-12" |
x <- as.Date("2024-08-12") # Example date object x # [1] "2024-08-12"
Example: Get Julian Day of Date Object Using as.POSIXlt() Function
x_julian <- as.POSIXlt(x)$yday # Get Julian day x_julian # [1] 224 |
x_julian <- as.POSIXlt(x)$yday # Get Julian day x_julian # [1] 224
Related Articles
Have a look at the following R programming tutorials. They discuss topics such as data conversion, data inspection, and dates.