weather_extract {cropgrowdays} | R Documentation |
Extract one or more columns of weather data between two dates
Description
Extract column(s) from a tibble/data frame of daily weather data between two specified dates. Either specify the start and end dates or specify one of these dates and also the number of days after or before, respectively.
Usage
weather_extract(
data,
var,
datevar = NULL,
ndays = 5,
startdate = NULL,
enddate = NULL,
monitor = FALSE,
return.dates = TRUE,
warn.consecutive = TRUE
)
Arguments
data |
Tibble or dataframe of daily weather data |
var |
Variable(s) to be extracted (Default: radn). Several columns
may be specified using column names |
datevar |
Date variable specifying day (Default: date_met) |
ndays |
Number of days after/before the start or end date, respectively. Ignored of both the start and end dates are specified (Default: 5) |
startdate |
Start date of data to be extracted |
enddate |
Final date of data to be extracted |
monitor |
For debugging. Prints data and dates. (Default: FALSE) |
return.dates |
A logical indicating whether to return the date column (Default: TRUE) |
warn.consecutive |
A logical indicating whether to check that dates are consecutive, that none are missing and provide a warning if not (Default:TRUE) |
Value
A tibble (data frame) of extracted weather data
See Also
between
filter
,
cumulative
, daily_mean
,
growing_degree_days
, and stress_days_over
Examples
library(lubridate)
boonah |>
weather_extract(rain, date = date_met, startdate = ymd("2019-08-16"),
enddate = ymd("2019-08-21"))
boonah |>
weather_extract(rain, startdate = ymd("2019-08-16"),
enddate = ymd("2019-08-21"))
boonah |>
weather_extract(maxt, date = date_met, startdate = ymd("2019-08-16"),
ndays = 3, return.dates = FALSE)
boonah |>
weather_extract(mint, enddate = ymd("2019-08-16"), ndays = 1)
## extract multiple columns
boonah |>
weather_extract(c(year, day, mint, maxt), enddate = ymd("2019-08-16"),
ndays = 3)