Learn R Programming

CircaCP (version 0.1.2)

import_acti_file: Import actigraphy with header stripping and harmonized Activity

Description

Reads a CSV/TSV, automatically strips any leading header lines, selects user specified Date and Time columns, and harmonizes one chosen activity column to the canonical name Activity. Adds an id (defaults to the file stem if not supplied).

Usage

import_acti_file(
  file,
  date_col,
  time_col,
  activity_cols,
  id = NULL,
  keep_extra = FALSE,
  drop_original_activity_cols = TRUE
)

Value

A data.frame with at least columns id, Date, Time, Activity.

Arguments

file

Character path to the actigraphy file.

date_col, time_col

Character names of the date and time columns in file.

activity_cols

Character vector of candidate activity columns; the first that exists will be used and renamed to Activity.

id

Optional subject id (character). Defaults to the filename stem.

keep_extra

Logical; if FALSE keeps only id, Date, Time, Activity, otherwise preserves extra columns present in the file.

drop_original_activity_cols

Logical; if TRUE, drop the original activity

Details

Internally uses data.table::fread() with automatic header detection (skips lines before the first row that looks like a header). No time zone conversion is performed.

See Also

screen_wear()