Learn R Programming

barrks (version 1.1.0)

create_daylength_df: Create a data frame of day lengths

Description

Generate a data frame of day lengths for given latitudes. The package geosphere is required to use this function.

Usage

create_daylength_df(lat, dates, .quiet = FALSE)

Value

A data frame with the columns date, station and daylength.

Arguments

lat

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

dates

Dates that should be processed.

.quiet

If TRUE, messages are suppressed.

See Also

create_daylength_rst()

Examples

Run this code
if (FALSE) { # rlang::is_installed("geosphere")
# dates of interest
date_start <- as.Date('2020-01-01')
date_end <- as.Date('2020-12-31')


# calculate day length
dl <- create_daylength_df(barrks_data('station_coords'),
                          seq(date_start, date_end, by = 'day'),
                          .quiet = TRUE)

# print day lengths of station 'Freiburg'
dl[dl$station == 'Freiburg',]
}

Run the code above in your browser using DataLab