Skip to contents

Compute statistical summaries for each numeric variable in a time series chunk or in a list of time series chunks.

Usage

summarize_chunks(
  l,
  FUN = summarize_chunk,
  parameter.names = FUN(NULL, return.names = TRUE),
  add.times = FALSE,
  tz = "UTC",
  time.shift = 0,
  add.solar.times = add.times && !is.null(geocode),
  geocode = NULL,
  verbose = FALSE
)

summarize_chunk(x, return.names = FALSE)

Arguments

l

a named list of data frames.

FUN

function The function used to compute the summary of a numeric vector.

parameter.names

The names used to identify the members of the vector returned by FUN.

add.times

logical If TRUE, list names are converted into POSIX.ct and Date values and added in columns named time and date.

tz

character The time zone used to decode times.

time.shift

numeric A time shift expressed in hours. Only needed if original times do not match those at the time zone passed as argument to tz,

add.solar.times

logical If TRUE, add local solar time in column solar.time in addition to time and date.

geocode

A one row data.frame with columns lat and lon with geographical coordinates as numeric values in degrees W and N.

verbose

logical Report chunk names while walking through l. Useful for debugging.

x

numeric vector.

return.names

logical Return the names of the parameters as a character vector instead of the computed numeric values.

Value

A tibble with 10 rows for each chunk in the input, with one summary per row and one column for each numeric column in the chunks with their original names plus columns chunk and parameter, and if requested columns time, date and solar.time added.

A numeric vector of length ten, or a character vector of the same length.

Details

A fixed set of summaries is computed for each numeric variable in a chunk and indexed by additional columns parameter and chunk.

If add.times == TRUE and the names in l are strings describing instants in time, they are decoded using functions anytime() and anydate() and added as columns time and date. If the argument passed to l was the list returned by split_chunks() the times and dates match those of the first time point in each chunk.

An argument passed to time.shift can be used to correct a consistent error in times such as a badly set clock during acquisition or when data acquisition times have been in UTC plus a constant time shift year round.