counts: counts

View source: R/counts.R

countsR Documentation

counts

Description

Calculates ActiLife counts based on raw accelerometer data

Usage

counts(
  data,
  hertz = -1,
  x_axis = 2,
  y_axis = 3,
  z_axis = 4,
  time_column = -1,
  start_time = -1
)

Arguments

data

Accelerometer data, Must have at least three columns.

hertz

Sampling frequency in Hz

x_axis

Indicates the column number which has the accel data for x direction, the default is 2

y_axis

Indicates the column number which has the accel data for y direction, the default is 3

z_axis

Indicates the column number which has the accel data for z direction, the default is 4

time_column

Optional. Indicates the column number which has the date and time. The first row will be considered as the start time of the study. You can use the "start_time" argument to provide the start time explicitly.

start_time

Optional. Use this to define the start time of the experiment. You can use this argument if the data does not contain a time column.

Value

Returns a data.table with four columns:

Time

The start time of the measurement

x

the number of counts for X axis

y

the number of counts for Y axis

z

the number of counts for Z axis

See Also

sampleXYZ raw accelerometer data for testing counts() function.

sampleCounts counts calculated by activityCounts and ActiLife

Examples

# for tha sampleXYZ dataset, sampling frequency is 100 Hz
counts(data = sampleXYZ, hertz = 100)

# when start time is given explicitly
study_start_time <- "2017-08-22 12:30:10"
counts(data = sampleXYZ, hertz = 100 , start_time = study_start_time)

# the data has a time column, which is the first column
counts(data = sampleXYZ, hertz = 100 , time_column = 1)

# explicitly specify the X, Y and Z axis columns.
counts(data = sampleXYZ, hertz = 100 , x_axis = 2,y_axis = 3, z_axis = 4)




activityCounts documentation built on April 12, 2025, 1:46 a.m.