Learn R Programming

barrks (version 1.1.0)

create_suntimes_df: Create a data frame of sunrises and sunsets

Description

Generate a data frame that specifies sunrises and sunsets for different coordinates and dates. The package suncalc is required to use this function.

Usage

create_suntimes_df(coords, dates, tz = Sys.timezone(), .quiet = FALSE)

Value

A data frame with the columns date, station and sunrise and sunset. The values of sunrise and sunset indicate the respective time in minutes.

Arguments

coords

Data frame with the fields station, lat and lon. Defines the latitude and longitude for the respective stations.

dates

Dates that should be processed.

tz

Timezone of the results.

.quiet

If TRUE, messages are suppressed.

See Also

create_suntimes_rsts()

Examples

Run this code
if (FALSE) { # rlang::is_installed("suncalc")
# \donttest{
date_start <- as.Date('2020-01-01')
date_end <- as.Date('2020-12-31')

st <- create_suntimes_df(barrks_data('station_coords'),
                         seq(date_start, date_end, by = 'day'),
                         .quiet = TRUE)

# print results of station 'Freiburg'
st[st$station == 'Freiburg',]
# }
}

Run the code above in your browser using DataLab