This function calculates the number of day and night hours for a given time range and location.
Usage
get_day_night_hours(start, finish, lat, lon, units = "hours")
Arguments
- start
A POSIXct object representing the start time.
- finish
A POSIXct object representing the end time.
- lat
The latitude of the location.
- lon
The longitude of the location.
- units
A string representing the units in which to output the time, defaults to 'hours'.
Value
A list containing the number of day and night hours.
Examples
if (FALSE) { # \dontrun{
day_night_hours <- get_day_night_hours(
start = Sys.time(),
finish = Sys.time() + lubridate::hours(24),
lat = 51.5074,
lon = 0.1278,
units = 'minutes'
)
} # }