read_body: Import accelerometer data

View source: R/read.R

read_bodyR Documentation

Import accelerometer data

Usage

read_body(
  file,
  type,
  undirect = F,
  replv = F,
  delim = "\t",
  format = NULL,
  tz = NULL,
  na.rm = F,
  cls = NULL,
  ...
)

Arguments

file

Path to source data file (xls, xlxs or csv).

type

Indicates the type of accelerometer data to be imported (see details for available abbreviations).

undirect

Logical. Convert directed to undirected edge: A->B | B->A = A<->B

replv

Anonymization. Default replv=FALSE will leave original (badge) IDs in place. Set to replv=TRUE will replace IDs with numbers starting from 1..n. Provide replv=data.frame with values: First column holds original values, second column replacement values.

delim

Single delimiter character for reading CSV data. Ignored for Excel files.

format

Optional format for parsing timestamp data. If no format is specified two pre-established timestamp formats are tried ut. See parse.smtrx for details.

tz

String. Default tz=NULL will use system timezone (Sys.timezone()) and assign to timestamp. Useful for explicitly setting other than system timezone for timestamp data.

na.rm

Logical. Calls na.omit on the entire data frame after conversion to tidy format.

cls

Vector of class names. Default cls=NULL uses pre-defined sociometric classes associated with the type abbreviation. However, class names can be specified explicitly as well.

Details

Excel file reading is performed by readxl::read_excel function. Column type specification might be required at times with the col_type parameter, passed via the "..."

The following accelerometer data sheets can be read by setting the type parameter to one of the following values:

  • "BM" - Body movement activity. This is the absolute value of the first derivative of energy. This provides a more reliable measure of someone’s activity, while eliminating the accelerometer’s magnitude natural offset. Values < 0.002 indicate very low activity; values between 0.003 - 0.19 moderate amounts of activity and > 0.2 movements like walking.

  • "BM_ACC" - Body movement. Accelerometer’s energy magnitude over the 3 axes of measurement.

  • "BM_RATE" - Body movement rate. This is the second derivative of energy. The sign (positive or negative) of Rate (BM) indicates the direction of the change in someone’s activity levels, as measured by Activity (BM). A positive Rate (BM) indicates the person’s activity is increasing. A negative Rate(BM) indicates the activity is decreasing.

  • "BM_CON" - Body movement consistency. Consistency ranges from 0 to 1, where 1 indicates no changes in activity level, and 0 indicates the maximum amount of variation in activity levels.

  • "BM_MIR" - Body movement mirroring. Mirroring (BM) values indicate how similar one badge’s Activity (BM) data series is to another badge’s Activity (BM) data series over time. The values range from 0 to 1, where 0 indicates no similarity and 1 indicates the two data series are identical.

  • "POS" - Posture. Left-right / front-back.

  • "POS_ACT" - Posture activity. Activity (Posture) shows the absolute angular velocity for every badge at every timestamp.

  • "POS_RATE"- Posture rate. Rate (Posture) shows the angular acceleration for every badge at every timestamp.

  • "POS_MIR" - Posture mirroring. See "BM_MIR".

Value

Object of type "act", "smtrx"


jmueller17/sociometrics documentation built on March 20, 2024, 1:04 a.m.