RAnEn::formatForecasts generates the AnEn Forecasts list required by analog computation.

formatForecasts(
  df,
  col.par,
  col.x,
  col.y,
  col.time,
  col.lead.time,
  time.series,
  col.value,
  verbose = T,
  preview = 2,
  remove.duplicates = T,
  circular.pars = NULL,
  col.station.name = NULL,
  show.progress = F,
  sort.stations = NULL
)

Arguments

df

A data frame to be converted to an R list.

col.par

The column name for parameter names.

col.x

The column name for station x coordinates.

col.y

The column name for station y coordinates.

col.time

The column name for forecast cycle time. The column should be POSIXct.

col.lead.time

The column name for forecast lead time. The column should be numeric for the number of seconds from the forecast cycle time.

time.series

The forecast cycle times to be extract into AnEn Forecasts. This should be a POSIXct vector.

col.value

The column name for data values.

verbose

Whether to print progress messages.

preview

How many entries to preview in progress messages.

remove.duplicates

Whether to remove redundant values associated with the same time. Sometimes, it is possible that, due to equipment mulfunctions, there are multiple measurements at the same time. Idealy this should cleaned prior to this function, but this function is able to keep the first appearance and remove the rest.

circular.pars

A character vector for the circular parameter names.

col.station.name

The column name for station names.

show.progress

Whether to show a progress bar.

sort.stations

Sort station. It can be Xs, Ys, or StationNames if it is set.

Value

An R list for AnEn Forecasts.

Details

The AnEn Forecasts is an R list with members including ParameterNames, Xs, Ys, Data, and etc., with a full list accessible here. RAnEn::formatForecasts make it easier to convert a data frame into a such list data structure.

I read this tutorial when developing functions with dplyr. It is very informative of using variables with dplyr functions.

See also

RAnEn::formatObservations