Package {actisensorlog}


Type: Package
Title: Summarize 'SensorLog'/'SensorLogger' Activity Data
Version: 0.2.0
Description: Provides functions for analyzing 'SensorLog' https://sensorlog.berndthomas.net/ and 'SensorLogger' https://www.tszheichoi.com/sensorlogger data.
License: GPL-3
Depends: R (≥ 4.1.0)
Suggests: testthat, covr, knitr, rmarkdown
Encoding: UTF-8
Imports: actibase, actiread, assertthat, dplyr, geosphere, janitor, lubridate, lutz, purrr, readr, tidyr
Config/roxygen2/version: 8.0.0
URL: https://github.com/jhuwit/actisensorlog, https://jhuwit.github.io/actisensorlog/
BugReports: https://github.com/jhuwit/actisensorlog/issues
NeedsCompilation: no
Packaged: 2026-09-02 15:48:01 UTC; johnmuschelli
Author: John Muschelli ORCID iD [aut, cre]
Maintainer: John Muschelli <muschellij2@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-12 13:10:16 UTC

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_sensorlog_file()

Value

A file path

Examples

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

Activity/Actigraphy Example Data

Description

Activity/Actigraphy Example Data

Usage

acti_example_sensorlogger_file()

Value

A file path

Examples

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

Activity/Actigraphy Example Data

Description

Activity/Actigraphy Example Data

Usage

acti_example_sensorlogger_location_file()

Value

A file path

Examples

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

Process SensorLog Data

Description

Process SensorLog Data

Usage

acti_process_sensorlog(
  data,
  lat = NULL,
  lon = NULL,
  dist_fun = geosphere::distVincentyEllipsoid,
  expected_timezone = NULL,
  check_data = TRUE,
  remove_cols = c("file", "index"),
  verbose = FALSE,
  ...,
  distance_cutoff = 180
)

acti_check_duplicate_times(data, remove_cols = c("file", "index"))

acti_calculate_distance(
  data,
  lat,
  lon,
  distance_cutoff = 180,
  dist_fun = geosphere::distVincentyEllipsoid,
  fast = TRUE
)

Arguments

data

A SensorLog-style data.frame

lat

Latitude of central point (e.g. home) to calculate distance. Set to NULL if distance should not be calculated.

lon

Longitude of central point (e.g. home) to calculate distance Set to NULL if distance should not be calculated.

dist_fun

Distance function to pass to geosphere::distm

expected_timezone

Expected Timezone based on the latitude/longitude of the data based on the lat/lon values from SensorLog ( e.g. "America/New_York"). Set to NULL if not to be checked.

check_data

should acti_check_duplicate_times be run?

remove_cols

columns to remove from duplicate checking in acti_check_duplicate_times. Default is c("file", "index")

verbose

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

...

additional arguments to pass to acti_sensorlog_process_time, including apply_tz and tz

distance_cutoff

Distance in meters to consider within home, in meters

fast

Calculate distance on the distinct latitude/longitude, not the full data. Should be used unless some precision looks wrong.

Value

A data.frame of transformed data

Note

This calls acti_check_duplicate_times, acti_calculate_distance, and acti_sensorlog_process_time

Examples

sensorlog = suppressMessages(
  actiread::acti_read_sensorlog(actiread::acti_example_sensorlog_file())
)
sensorlog = dplyr::distinct(sensorlog, time, .keep_all = TRUE)
result = acti_process_sensorlog(
  sensorlog,
  lat = 39.3,
  lon = -76.6,
  expected_timezone = "America/New_York",
  check_data = FALSE
)
head(result)
minute = acti_minute_sensorlog(result)
summary = acti_summarize_sensorlog(result)


Read SensorLog Data

Description

Read SensorLog Data

Usage

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

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)

Read SensorLogger Data

Description

Read SensorLogger Data

Usage

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

Arguments

file

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

verbose

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

...

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

Value

A data.frame of data


Read SensorLogger Data

Description

Read SensorLogger Data

Usage

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


Read SensorLogger Data

Description

Read SensorLogger Data

Usage

acti_read_sensorlogger_location(file, ...)

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

Value

A data.frame of data


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 SensorLog Data

Description

Read SensorLog Data

Usage

acti_sensorlog_csv_colnames_mapping()

Value

A data.frame of data

Examples

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

Read SensorLog Data

Description

Read SensorLog Data

Usage

acti_sensorlog_csv_spec()

Value

A data.frame of data

Examples

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

Process the Time data from SensorLog and Compare to an Expected Timezone

Description

Process the Time data from SensorLog and Compare to an Expected Timezone

Usage

acti_sensorlog_process_time(
  data,
  expected_timezone = "America/New_York",
  tz = "GMT",
  apply_tz = TRUE,
  check_data = TRUE,
  verbose = FALSE,
  ...
)

Arguments

data

A SensorLog-style data.frame

expected_timezone

Expected Timezone based on the latitude/longitude of the data based on the lat/lon values from SensorLog ( e.g. "America/New_York"). Set to NULL if not to be checked.

tz

timezone to project the data into. Keeping as GMT and should have same value for apply_tz to agree (caution: always check data) with ActiGraph, passed to lubridate::as_datetime.

apply_tz

Apply the timezone from the timezone shift from the timezone, e.g. "2025-03-11T14:44:11-04:00" becomes "2025-03-11T18:44:11" if apply_tz = TRUE, but "2025-03-11T14:44:11" if apply_tz = FALSE.

check_data

if TRUE any duplicates for time are checked for.

verbose

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

...

additional arguments to pass to lutz::tz_lookup_coords()

Value

A data.frame


Read SensorLogger Data

Description

Read SensorLogger Data

Usage

acti_sensorlogger_location_colnames_mapping()

Value

A data.frame of data


Read SensorLogger Data

Description

Read SensorLogger Data

Usage

acti_sensorlogger_location_spec()

Value

A data.frame of data


Summarize SensorLog Data

Description

Summarize SensorLog Data

Usage

acti_summarize_sensorlog(data)

acti_summarise_sensorlog(data)

acti_minute_sensorlog(data, seconds = 60L)

acti_summarize_distance_sensorlog(data)

Arguments

data

A SensorLog-style data.frame, usually output from acti_process_sensorlog

seconds

integer of the number of seconds to summarize the data for the "minute" level. Usually 1 minute/60 seconds. For acti_summarize_distance_sensorlog, summarization is done depending on how the data is grouped.

Value

The data.frame with the summarized data for each date