After completing this tutorial, you will be able to:
- Covert day of year values to normal date format in R.
What You Need
You will need a computer with internet access to complete this lesson and the data for week 8 of the course.
Landsat data are often saved using a date that includes the year and the day of year. You can quickly convert day of year to date as follows:
Here is your file name:
Looking at the name, you can see that the data were collected 2016-189. This references the 189th day of the year in 2016.
You can quickly convert this in
# note that R uses a 0 based index for dates only # this means it starts counting at 0 rather than 1 when working with dates as.Date(0, origin = "2016-01-01") ##  "2016-01-01" # note that R uses a 0 based index as.Date(1, origin = "2016-01-01") ##  "2016-01-02" # figure out the date for day 189 as.Date(189, origin = "2016-01-01") ##  "2016-07-08"