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"

Example: Get Julian Day of Date Object Using as.POSIXlt() Function

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top