Learn R Programming

mpathsenser (version 1.2.3)

alias_column_names: Alias column names of a data frame containing sensor data

Description

This function is used to remap the column names of a data frame containing sensor data to the column names used in the database schema of mpathsenser. As the column names have already changed several times over the year, we use these functions so we can easily add new aliases of the existing columns. The function is generic and dispatches to the specific method for the class of data.

Usage

alias_column_names(data, ...)

Value

A data frame with the column names remapped according to the specific method for this data frame.

Arguments

data

A data frame for which the column names are remapped according to the specific method for this data frame. As such, data should have a class attribute that corresponds to one of the methods defined in this file.

...

These dots are for future extensions and must be empty.

Details

Aliasing of the column names depends on the specific method, but column names are only changed if they have an alias available. Otherwise, they are kept unchanged.

Examples

Run this code
x <- data.frame(
  id = 1:3,
  timestamp = as.POSIXct(c("2021-01-01 00:00:00", "2021-01-01 00:00:01", "2021-01-01 00:00:02")),
  xm = c(1, 2, 3),
  ym = c(4, 5, 6),
  zm = c(7, 8, 9)
)
class(x) <- c("accelerometer", class(x))
mpathsenser:::alias_column_names(x)

Run the code above in your browser using DataLab