Scale the day of the year to 0-1 (like NDVI).
scale_doy(DT, doy = "DayOfYear")
data.table with appended 't' column of 0-1 scaled day of year.
Other scale:
scale_ndvi()
# Load data.table
library(data.table)
# Read in example data
ndvi <- fread(system.file("extdata", "sampled-ndvi-MODIS-MOD13Q1.csv", package = "irg"))
# Scale DOY
scale_doy(ndvi)
#> id NDVI SummaryQA DayOfYear yr t
#> <int> <num> <num> <num> <num> <num>
#> 1: 0 0.1864 3 11 2015 0.027397260
#> 2: 1 0.0541 2 3 2015 0.005479452
#> 3: 2 0.1781 3 11 2015 0.027397260
#> 4: 3 0.1024 2 5 2015 0.010958904
#> 5: 4 0.0898 2 3 2015 0.005479452
#> ---
#> 801: 2 0.1179 2 364 2019 0.994520548
#> 802: 3 0.0789 2 364 2019 0.994520548
#> 803: 4 0.1572 2 364 2019 0.994520548
#> 804: 5 0.0763 2 364 2019 0.994520548
#> 805: 6 0.1197 2 362 2019 0.989041096