dt_aggregate: Aggregate data by time unit

View source: R/dt_aggregate.R

dt_aggregateR Documentation

Aggregate data by time unit

Description

dt_aggregate() aggregates numeric values to a specified time unit. Columns with uniform character values are retained (i.e. patient ID, sensor name).

Usage

dt_aggregate(
  df,
  dt_field = NULL,
  unit = "5 seconds",
  summary_fun = "median",
  na_rm = TRUE
)

Arguments

df

a data frame with a datetime field.

dt_field

character; name of datetime field.

unit

character; string specifying a time unit or a multiple of a unit to be rounded

summary_fun

character; summary function (i.e. 'mean', 'median'). Default = 'median.'

na_rm

logical; should NA values be removed before the chosen summary_fun computes?

Examples

## Not run: 

dt_aggregate(df,
  dt_field = "Date_Time",
  unit = "5 seconds",
  summary_fun = "median", na_rm = TRUE
)

## End(Not run)

wolfeclw/circleclust documentation built on Aug. 13, 2024, 3:33 a.m.