Package 'actiread'

Title: Baseline Package for Reading Actigraphy and Activity Data
Description: Provides baseline functions for reading actigraphy and activity data, relying on baseline functions from 'actibase'. Reads data from 'Axivity' 'CWA' <https://axivity.com/> , ActiGraph 'GT3X' <https://ametris.com/actigraph-wgt3x-bt>, 'SensorLog' <https://sensorlog.berndthomas.net/>, and 'SensorLogger' <https://www.tszheichoi.com/sensorlogger> zipped CSV files.
Authors: John Muschelli [aut, cre] (ORCID: <https://orcid.org/0000-0001-6469-1750>)
Maintainer: John Muschelli <[email protected]>
License: GPL-3
Version: 0.2.0
Built: 2026-07-07 17:17:33 UTC
Source: https://github.com/cran/actiread

Help Index


Convert vectors ensuring no new NA

Description

Convert vectors ensuring no new NA

Usage

acti_convert_sensorlogger_time(x)

Arguments

x

a vector

Value

A converted 'vector' the same length as 'x' or errors if there are introduced NAs.


Activity/Actigraphy Example Data

Description

Activity/Actigraphy Example Data

Usage

acti_example_gt3x()

acti_example_cwa()

acti_example_sensorlog_file()

acti_example_sensorlogger_file()

acti_example_sensorlogger_location_file()

Value

A file path

Examples

library(actiread)
acti_example_gt3x()
acti_example_cwa()
acti_example_sensorlogger_file()

Read CWA File

Description

Read CWA File

Usage

acti_read_cwa(
  path,
  start = 0,
  end = Inf,
  tz = "UTC",
  ...,
  apply_tz = TRUE,
  verbose = TRUE
)

Arguments

path

Path to cwa file

start

where to start in the file, passed to GGIRread::readAxivity

end

where to end in the file, passed to GGIRread::readAxivity

tz

time zone for the data time, passed to desiredtz argument in GGIRread::readAxivity. If NULL or "", no time conversion is done.

...

additional arguments to pass to GGIRread::readAxivity()

apply_tz

turn the time column into a POSIXct and apply the timezone

verbose

print diagnostic messages, higher values = more verbosity.

Value

A tibble with attributes of a header, sample rate, and transformations

Examples

data = acti_read_cwa(acti_example_cwa())
data = acti_read_cwa(
  acti_example_cwa(),
  tz = NULL,
  apply_tz = FALSE,
  verbose = FALSE
)

Read GT3X file

Description

Read GT3X file

Usage

acti_read_gt3x(
  path,
  asDataFrame = TRUE,
  imputeZeroes = TRUE,
  verbose = TRUE,
  ...,
  fill_zeroes = TRUE,
  apply_tz = FALSE,
  check_attributes = TRUE,
  tz = "GMT"
)

acti_info_gt3x(path, ...)

Arguments

path

Path to gt3x file

asDataFrame

convert to an activity_df, see as.data.frame.activity

imputeZeroes

Impute zeros in case there are missingness? Default is FALSE, in which case the time series will be incomplete in case there is missingness.

verbose

print diagnostic messages, higher values = more verbosity.

...

additional arguments to pass to read.gt3x::read.gt3x()

fill_zeroes

Rows with all zeros will be filled in with the last observation carried forward as is done with ActiLife. Recommended

apply_tz

Apply the timezone from the header TimeZone attribute, if available

check_attributes

Check that the attributes are included This is a sanity check, including checking that sample_rate is in the attributes.

tz

timezone to project the data into. The data read in via read.gt3x::read.gt3x() says the timezone is GMT, but the time values is in the native timezone. So this data is projected into the correct time zone and then forced into the timezone given by tz. Set to NULL to not apply this forcing.

Value

A data.frame

Examples

library(actiread)
data = acti_read_gt3x(acti_example_gt3x())
data = acti_read_gt3x(
  acti_example_gt3x(),
  tz = NULL,
  apply_tz = FALSE,
  verbose = FALSE,
  fill_zeroes = FALSE
)
info = acti_info_gt3x(acti_example_gt3x())

Read SensorLog Data

Description

Read SensorLog Data

Usage

acti_read_sensorlog(file, verbose = FALSE, robust = FALSE)

acti_sensorlog_csv_spec()

acti_sensorlog_csv_colnames_mapping()

Arguments

file

A character vector of SensorLog files, usually from unzipping the file

verbose

print diagnostic messages. Either logical or integer, where higher values are higher levels of verbosity.

robust

if TRUE then acti_rewrite_sensorlog_csv is run on the data to try to fix any shifts with the data.

Value

A data.frame of data

Examples

library(actiread)
file = acti_example_sensorlog_file()
df = acti_read_sensorlog(file)
head(df)

Rewrite a CSV that may have issues with export from SensorLog

Description

Rewrite a CSV that may have issues with export from SensorLog

Usage

acti_rewrite_sensorlog_csv(
  file,
  outfile = tempfile(fileext = ".csv"),
  verbose = FALSE
)

Arguments

file

Input CSV file

outfile

Output CSV file

verbose

Print Diagnostic messages

Value

A file path to the new CSV

Examples

sl_file = actiread::acti_example_sensorlog_file()
tfile = tempfile()
files = utils::unzip(sl_file, exdir = tfile)
result = actiread::acti_rewrite_sensorlog_csv(files)

Read SensorLogger Data

Description

Read SensorLogger Data

Usage

acti_sensorlogger_location_colnames_mapping()

acti_sensorlogger_location_spec()

acti_read_sensorlogger_location(file, ...)

acti_read_sensorlogger(file, verbose = FALSE, ...)

acti_read_sensorlogger_general(file, ..., verbose = FALSE)

Arguments

file

A character vector of SensorLogger files, usually from unzipping the file, or a zip file of SensorLogger files

...

additional arguments to pass to readr::read_csv(). If verbose = FALSE, then progress = FALSE and show_col_types = FALSE, unless otherwise overridden

verbose

print diagnostic messages. Either logical or integer, where higher values are higher levels of verbosity.

Value

A data.frame of data


Transform timezone offset to timezone

Description

Transform timezone offset to timezone

Usage

tzoffset_to_tz(x)

Arguments

x

A character vector

Value

A character vector

Examples

tzoffset_to_tz(c("+00:00", "-05:00", "+01:00"))