Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

eedate_to_rdate

Pass an Earth Engine date object to R


Description

Pass an Earth Engine date object to R

Usage

eedate_to_rdate(ee_date, timestamp = FALSE)

Arguments

ee_date

ee$date object (ee$Date)

timestamp

Logical. If TRUE, return the date in milliseconds from the Unix Epoch (1970-01-01 00:00:00 UTC). Otherwise, return the date as a POSIXct object. By default FALSE.

Details

eedate_to_rdate is essential to avoid potential errors that might appear when users call to retrieve dates. Currently, R integer only supports 32 bit signed (such integers can only count up to about 2 billion). This range is notably insufficient for dealing with GEE date objects represented by timestamps in milliseconds since the UNIX epoch. eedate_to_rdate uses Python in the backend to obtain the date and convert it in float before exporting to R.

Value

eedate_to_rdate will return either a numeric timestamp or a POSIXct object depending on the timestamp argument.

See Also

Other date functions: ee_get_date_ic(), ee_get_date_img(), rdate_to_eedate()

Examples

## Not run: 
library(rgee)
ee_Initialize()

eeDate <- ee$Date$fromYMD(2010,1,1)
eedate_to_rdate(eeDate,timestamp = TRUE) # good
eeDate$getInfo()$value # bad

## End(Not run)

rgee

R Bindings for Calling the 'Earth Engine' API

v1.0.9
Apache License (>= 2.0)
Authors
Cesar Aybar [aut, cre] (<https://orcid.org/0000-0003-2745-9535>), Wu Qiusheng [ctb] (<https://orcid.org/0000-0001-5437-4073>), Lesly Bautista [ctb] (<https://orcid.org/0000-0003-3523-8687>), Roy Yali [ctb] (<https://orcid.org/0000-0003-4542-3755>), Antony Barja [ctb] (<https://orcid.org/0000-0001-5921-2858>), Kevin Ushey [ctb], Jeroen Ooms [ctb] (<https://orcid.org/0000-0002-4035-0289>), Tim Appelhans [ctb], JJ Allaire [ctb], Yuan Tang [ctb], Samapriya Roy [ctb], MariaElena Adauto [ctb] (<https://orcid.org/0000-0002-2154-2429>), Gabriel Carrasco [ctb] (<https://orcid.org/0000-0002-6945-0419>), Henrik Bengtsson [ctb], Jeffrey Hollister [rev] (Hollister reviewed the package for JOSS, see https://github.com/openjournals/joss-reviews/issues/2272/), Gennadii Donchyts [rev] (Gena reviewed the package for JOSS, see https://github.com/openjournals/joss-reviews/issues/2272/), Marius Appel [rev] (Appel reviewed the package for JOSS, see https://github.com/openjournals/joss-reviews/issues/2272/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.