create_daylength_df: Create a data frame of day lengths

View source: R/create-daylengths.R

create_daylength_dfR Documentation

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)

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.

Value

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

See Also

create_daylength_rst()

Examples


# 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',]


barrks documentation built on April 3, 2025, 9:47 p.m.