| Title: | Baseline Functions for Actigraphy and Activity Processing and Analysis |
|---|---|
| Description: | Provides baseline functions for actigraphy and activity data. This package is intended to be extended by downstream overlays such as 'actiread', 'actimetrics', and 'stepcount'. |
| Authors: | John Muschelli [aut, cre] (ORCID: <https://orcid.org/0000-0001-6469-1750>) |
| Maintainer: | John Muschelli <[email protected]> |
| License: | GPL-3 |
| Version: | 0.8.0 |
| Built: | 2026-10-16 23:49:03 UTC |
| Source: | https://github.com/jhuwit/actibase |
Calculate a Baseline-Relative Activity-Day Index
acti_day_index( time, day_start = hms::hms(0), origin = NULL, start = 1L, timezone = NULL )acti_day_index( time, day_start = hms::hms(0), origin = NULL, start = 1L, timezone = NULL )
time |
A |
day_start |
An |
origin |
Optional |
start |
The index assigned to the baseline day, either |
timezone |
Optional Olson timezone used to define the day boundary. |
An integer vector.
A stable recording-relative day number supports faceting and alignment across participants even when their calendar start dates differ.
time = as.POSIXct(c("2020-01-01 03:00:00", "2020-01-01 05:00:00"), tz = "UTC") acti_day_index(time, day_start = "04:00")time = as.POSIXct(c("2020-01-01 03:00:00", "2020-01-01 05:00:00"), tz = "UTC") acti_day_index(time, day_start = "04:00")
This is a custom-day-boundary alternative to
lubridate::floor_date() with unit = "day". Use floor_date() when days
begin at midnight; use acti_day_start() when a recording day begins at a
different time, such as 04:00.
acti_day_start(time, day_start = hms::hms(0), timezone = NULL)acti_day_start(time, day_start = hms::hms(0), timezone = NULL)
time |
A |
day_start |
An |
timezone |
Optional Olson timezone used to define the day boundary. |
A POSIXct vector.
Activity studies often use a non-midnight boundary (for example, 04:00) so nocturnal behavior is assigned to the preceding activity day.
time = as.POSIXct(c("2020-01-01 03:00:00", "2020-01-01 05:00:00"), tz = "UTC") # With a midnight boundary, this agrees with floor_date(). acti_day_start(time) lubridate::floor_date(time, unit = "day") # With a 04:00 boundary, 03:00 belongs to the preceding activity day. acti_day_start(time, day_start = "04:00")time = as.POSIXct(c("2020-01-01 03:00:00", "2020-01-01 05:00:00"), tz = "UTC") # With a midnight boundary, this agrees with floor_date(). acti_day_start(time) lubridate::floor_date(time, unit = "day") # With a 04:00 boundary, 03:00 belongs to the preceding activity day. acti_day_start(time, day_start = "04:00")
Fill in Zeros
acti_fill_zeros(data) acti_fill_zeroes(data) acti_remove_leading_zeros(data) acti_remove_leading_zeroes(data)acti_fill_zeros(data) acti_fill_zeroes(data) acti_remove_leading_zeros(data) acti_remove_leading_zeroes(data)
data |
a data frame containing columns time, X, Y, Z |
the modified data frame with zeros replaced by NA
acti_fill_zeros(acti_raw_data) acti_fill_zeroes(acti_raw_data)acti_fill_zeros(acti_raw_data) acti_fill_zeroes(acti_raw_data)
Marks the previous and next observed periods when their timestamps are
exactly window_seconds apart. Groups are evaluated independently.
acti_flag_adjacent_invalid_periods( data, invalid, time = "time", window_seconds, group = NULL )acti_flag_adjacent_invalid_periods( data, invalid, time = "time", window_seconds, group = NULL )
data |
Minute-level summary data. |
invalid |
Logical vector identifying invalid periods. |
time |
Name of the timestamp column. |
window_seconds |
Expected duration between adjacent periods. |
group |
Optional grouping column name(s). |
Input data with flag_adjacent_invalid.
Creates a character column containing the CDC letter codes corresponding
to TRUE package flag columns. Multiple codes are concatenated in
alphabetical order. The default map expects axis-specific columns where
the package provides them; run the relevant detector with by_axis = TRUE
for spikes and interval jumps. The helper maps existing results and does
not run any flag detector.
acti_flag_cdc_labels( data, flag_map = c(A = "flag_spike_X", B = "flag_spike_Y", C = "flag_spike_Z", D = "flag_device_max_X", E = "flag_device_max_Y", F = "flag_device_max_Z", G = "flag_device_min_X", H = "flag_device_min_Y", I = "flag_device_min_Z", J = "flag_contiguous_max_X", K = "flag_contiguous_max_Y", L = "flag_contiguous_max_Z", M = "flag_contiguous_min_X", N = "flag_contiguous_min_Y", O = "flag_contiguous_min_Z", P = "flag_impossible", Q = "flag_all_zero", R = "flag_repeated_samples", S = "flag_spike_second_X", T = "flag_spike_second_Y", U = "flag_spike_second_Z", V = "flag_adjacent_invalid", W = "flag_interval_jump_X", X = "flag_interval_jump_Y", Y = "flag_interval_jump_Z"), output = "PAXFLGSM", separator = "" )acti_flag_cdc_labels( data, flag_map = c(A = "flag_spike_X", B = "flag_spike_Y", C = "flag_spike_Z", D = "flag_device_max_X", E = "flag_device_max_Y", F = "flag_device_max_Z", G = "flag_device_min_X", H = "flag_device_min_Y", I = "flag_device_min_Z", J = "flag_contiguous_max_X", K = "flag_contiguous_max_Y", L = "flag_contiguous_max_Z", M = "flag_contiguous_min_X", N = "flag_contiguous_min_Y", O = "flag_contiguous_min_Z", P = "flag_impossible", Q = "flag_all_zero", R = "flag_repeated_samples", S = "flag_spike_second_X", T = "flag_spike_second_Y", U = "flag_spike_second_Z", V = "flag_adjacent_invalid", W = "flag_interval_jump_X", X = "flag_interval_jump_Y", Y = "flag_interval_jump_Z"), output = "PAXFLGSM", separator = "" )
data |
Data containing logical flag columns. |
flag_map |
Named character vector mapping CDC letters to column names.
Defaults to the package's axis-specific flag names and uses the mapped
columns present in |
output |
Name of the output column. |
separator |
String inserted between multiple letters. Use |
Input data with a character column of CDC-style flag letters.
Marks axis-specific positive and negative device-limit samples in runs
meeting min_length. Runs are broken at timestamp gaps based on the
extracted or supplied sampling rate.
acti_flag_contiguous_device_limit_runs( data, dynamic_range = NULL, epsilon = 0.05, min_length = 1, sample_rate = NULL ) acti_flag_contiguous_device_limits( data, dynamic_range = NULL, epsilon = 0.05, min_length = 1, sample_rate = NULL )acti_flag_contiguous_device_limit_runs( data, dynamic_range = NULL, epsilon = 0.05, min_length = 1, sample_rate = NULL ) acti_flag_contiguous_device_limits( data, dynamic_range = NULL, epsilon = 0.05, min_length = 1, sample_rate = NULL )
data |
Raw accelerometer data. |
dynamic_range |
Device range; inferred when omitted. |
epsilon |
Margin inside the device limit, in g. |
min_length |
Minimum run length. |
sample_rate |
Sampling frequency; extracted from data when omitted. |
Input data with six axis- and sign-specific contiguous run columns.
Groups samples into fixed-duration windows from the first timestamp,
counts values at the positive and negative device limits on each axis, and
compares each count with min_count.
acti_flag_device_limit_windows( data, dynamic_range = NULL, epsilon = 0.05, min_count = 1, window_seconds = 60 )acti_flag_device_limit_windows( data, dynamic_range = NULL, epsilon = 0.05, min_count = 1, window_seconds = 60 )
data |
Raw accelerometer samples with a timestamp column. |
dynamic_range |
Device range; inferred when omitted. |
epsilon |
Margin inside the device limit, in g. |
min_count |
Minimum number of samples required within a window. |
window_seconds |
Window duration in seconds. |
One row per window with axis-specific flags.
Flag Quality Control Values
acti_flag_qc( data, dynamic_range = NULL, verbose = TRUE, flags = c("all", "spike", "interval_jump", "spike_second", "same_value", "device_limit", "all_zero", "impossible") ) acti_flag_qc_all( data, dynamic_range = NULL, verbose = TRUE, flags = c("all", "spike", "interval_jump", "spike_second", "same_value", "device_limit", "all_zero", "impossible") )acti_flag_qc( data, dynamic_range = NULL, verbose = TRUE, flags = c("all", "spike", "interval_jump", "spike_second", "same_value", "device_limit", "all_zero", "impossible") ) acti_flag_qc_all( data, dynamic_range = NULL, verbose = TRUE, flags = c("all", "spike", "interval_jump", "spike_second", "same_value", "device_limit", "all_zero", "impossible") )
data |
A data set of actigraphy |
dynamic_range |
dynamic range of the device, used to find the device limit. |
verbose |
print diagnostic messages |
flags |
the flags to run for QC. If you set this to |
A data set with a flags column (acti_flag_qc) or a number of
columns starting with flag_* (acti_flag_qc_all)
res = acti_raw_data out = acti_flag_qc(res)res = acti_raw_data out = acti_flag_qc(res)
Marks samples in runs of repeated three-axis observations. Options can exclude all-zero observations or require equal values across the three axes. Timestamp gaps break runs based on the supplied or extracted rate.
acti_flag_repeated_samples( data, sample_rate = NULL, min_length = 2, exclude_zero = FALSE, require_equal_axes = FALSE )acti_flag_repeated_samples( data, sample_rate = NULL, min_length = 2, exclude_zero = FALSE, require_equal_axes = FALSE )
data |
Raw accelerometer data. |
sample_rate |
Sampling frequency; extracted from data when omitted. |
min_length |
Minimum repeated run length in samples. |
exclude_zero |
Exclude samples where all axes are zero. |
require_equal_axes |
Require all axes to have equal values. |
Input data with flag_repeated_samples.
Flag Spikes
acti_flag_spike(data, spike_size = 11, sample_rate = NULL, by_axis = FALSE) acti_flag_interval_jump( data, verbose = FALSE, window_seconds = 1, min_repeats = 10, min_distinct = 3, min_separation = 0.5, by_axis = FALSE, digits = 3, chunk_windows = 50000L ) acti_flag_spike_second( data, spike_size = 11, window_seconds = 1, min_spikes = 13, max_change_seconds = 0.1, sample_rate = NULL, by_axis = FALSE ) acti_flag_device_limit(data, dynamic_range = NULL, epsilon = 0.05) acti_flag_adjacent_device_limit_samples( data, dynamic_range = NULL, epsilon = 0.05, sample_rate = NULL ) acti_flag_contiguous_device_limit( data, dynamic_range = NULL, epsilon = 0.05, sample_rate = NULL ) acti_flag_same_value(data, min_length = 1, sample_rate = NULL) acti_flag_all_zero(data, min_length = 3, sample_rate = NULL) acti_flag_impossible( data, min_length = 7, change_threshold = 0.01, magnitude_threshold = 1.25, sample_rate = NULL, dynamic_range = NULL )acti_flag_spike(data, spike_size = 11, sample_rate = NULL, by_axis = FALSE) acti_flag_interval_jump( data, verbose = FALSE, window_seconds = 1, min_repeats = 10, min_distinct = 3, min_separation = 0.5, by_axis = FALSE, digits = 3, chunk_windows = 50000L ) acti_flag_spike_second( data, spike_size = 11, window_seconds = 1, min_spikes = 13, max_change_seconds = 0.1, sample_rate = NULL, by_axis = FALSE ) acti_flag_device_limit(data, dynamic_range = NULL, epsilon = 0.05) acti_flag_adjacent_device_limit_samples( data, dynamic_range = NULL, epsilon = 0.05, sample_rate = NULL ) acti_flag_contiguous_device_limit( data, dynamic_range = NULL, epsilon = 0.05, sample_rate = NULL ) acti_flag_same_value(data, min_length = 1, sample_rate = NULL) acti_flag_all_zero(data, min_length = 3, sample_rate = NULL) acti_flag_impossible( data, min_length = 7, change_threshold = 0.01, magnitude_threshold = 1.25, sample_rate = NULL, dynamic_range = NULL )
data |
A data set of actigraphy |
spike_size |
size of "spike" - which is the absolute difference in contiguous observations on a single axis |
sample_rate |
Sampling frequency; extracted from data when omitted. |
by_axis |
If |
verbose |
print diagnostic messages |
window_seconds |
Width of each window used by |
min_repeats |
Minimum occurrences of an axis value in a window. |
min_distinct |
Minimum number of frequent axis values required. |
min_separation |
Minimum separation between retained values. |
digits |
Number of decimal places used when grouping axis values. |
chunk_windows |
Number of windows processed together to bound memory. |
min_spikes |
Minimum number of qualifying extrema in a window. |
max_change_seconds |
Maximum time between an extremum and a qualifying large change; the CDC rule uses less than 0.1 seconds. |
dynamic_range |
Device dynamic range. When omitted, it is read from the
data with |
epsilon |
A small adjustment so that if values are within the
device limit, but minus epsilon, still flagged as hitting the limit.
For example, if |
min_length |
minimum length of the condition for contiguous
samples. If |
change_threshold |
Maximum absolute change between adjacent samples on each axis for a stable run to qualify. The default is 0.01 g. |
magnitude_threshold |
Minimum vector magnitude required at both ends of each stable adjacent pair. The default is 1.25 g. |
These functions provide configurable sample-level and window-level
signal indicators. Thresholds and run or window lengths are arguments;
they do not encode a specific device or study's quality-control scheme.
When continuity is checked, sample_rate is extracted with
get_sample_rate() unless supplied explicitly.
A data set back
acti_flag_spike compares adjacent observations by axis. The
acti_flag_spike_second checks for repeated local extrema followed by a large
change within the requested time, then counts them within each window.
res = acti_raw_data res = acti_flag_spike(res) res = acti_flag_interval_jump(res) res = acti_flag_spike_second(res) res = acti_flag_same_value(res) res = acti_flag_device_limit(res) res = acti_flag_all_zero(res) res = acti_flag_impossible(res)res = acti_raw_data res = acti_flag_spike(res) res = acti_flag_interval_jump(res) res = acti_flag_spike_second(res) res = acti_flag_same_value(res) res = acti_flag_device_limit(res) res = acti_flag_all_zero(res) res = acti_flag_impossible(res)
Convert an HMS Time to a Minute Index
acti_hms_to_minute(x, start = 1L)acti_hms_to_minute(x, start = 1L)
x |
An |
start |
The index assigned to midnight, either |
An integer minute-of-day index.
This is a strict hms entry point for callers that have already
separated time of day from date and want the standard activity-day index.
acti_hms_to_minute(hms::hms(hours = c(0, 23), minutes = c(0, 59)))acti_hms_to_minute(hms::hms(hours = c(0, 23), minutes = c(0, 59)))
Convert a Minute Index to an HMS Time
acti_minute_to_hms(minute, start = 1L)acti_minute_to_hms(minute, start = 1L)
minute |
Whole-minute positions in a day. |
start |
The index assigned to midnight, either |
An hms vector.
This is the inverse of acti_time_to_minute() for readable axis labels
and for joining minute-indexed results back to a time-of-day value.
acti_minute_to_hms(c(1, 721, 1440)) acti_minute_to_hms(c(0, 1439), start = 0)acti_minute_to_hms(c(1, 721, 1440)) acti_minute_to_hms(c(0, 1439), start = 0)
Example Actigraphy/Activity Raw Data
acti_raw_dataacti_raw_data
A data.frame with the columns
time column
X-axis column
Y-axis column
Z-axis column
Repeat a Time of Day Across a Recording
acti_repeat_time_of_day(seconds, time, timezone = NULL)acti_repeat_time_of_day(seconds, time, timezone = NULL)
seconds |
Seconds after midnight, or an |
time |
A |
timezone |
Optional Olson timezone; by default the timezone of |
A POSIXct vector with one occurrence per recording date.
This supplies daily plotting boundaries such as a fixed bedtime or wake time for every calendar date present in a recording.
time = as.POSIXct(c("2020-01-01 12:00:00", "2020-01-03 12:00:00"), tz = "UTC") acti_repeat_time_of_day("01:30", time)time = as.POSIXct(c("2020-01-01 12:00:00", "2020-01-03 12:00:00"), tz = "UTC") acti_repeat_time_of_day("01:30", time)
Resample 3-axial input signal to a specific sampling rate
acti_resample(data, sample_rate, method = "linear", ...) acti_resample_to_time(data, times, method = "linear", ...)acti_resample(data, sample_rate, method = "linear", ...) acti_resample_to_time(data, times, method = "linear", ...)
data |
A |
sample_rate |
sampling frequency, coercible to an integer. This is the sampling rate you're sampling the data into. |
method |
method for interpolation. Options are
|
... |
additional arguments to pass to |
times |
a vector of |
A data.frame/tibble of time and X, Y, Z.
old = options(digits.secs = 3) x = acti_raw_data res = acti_resample(data = x, sample_rate = 80) res = acti_resample(data = x, sample_rate = 100) res = acti_resample(data = x, sample_rate = 1) res = acti_resample_to_time( data = x, times = lubridate::floor_date(x$time, unit = "1 sec"), ) res_nat = acti_resample_to_time( data = x, times = lubridate::floor_date(x$time, unit = "1 sec"), method = "natural" ) options(old)old = options(digits.secs = 3) x = acti_raw_data res = acti_resample(data = x, sample_rate = 80) res = acti_resample(data = x, sample_rate = 100) res = acti_resample(data = x, sample_rate = 1) res = acti_resample_to_time( data = x, times = lubridate::floor_date(x$time, unit = "1 sec"), ) res_nat = acti_resample_to_time( data = x, times = lubridate::floor_date(x$time, unit = "1 sec"), method = "natural" ) options(old)
Separate Times into Date, Hour, and Minute
acti_separate_time(data) acti_separate_times(data) acti_create_date(data) acti_create_hour(data) acti_create_minute(data)acti_separate_time(data) acti_separate_times(data) acti_create_date(data) acti_create_hour(data) acti_create_minute(data)
data |
a |
A data.frame with date, hour, minute, and day columns
library(actibase) acti_separate_time(acti_raw_data) acti_create_date(acti_raw_data) acti_create_hour(acti_raw_data) acti_create_minute(acti_raw_data)library(actibase) acti_separate_time(acti_raw_data) acti_create_date(acti_raw_data) acti_create_hour(acti_raw_data) acti_create_minute(acti_raw_data)
Split Intervals at Midnight
acti_split_intervals_at_midnight(start, end, timezone = NULL)acti_split_intervals_at_midnight(start, end, timezone = NULL)
start, end
|
Equally sized |
timezone |
Optional Olson timezone used to define midnight. |
A data frame with input interval number and split start/end.
Sleep, wear, and activity episodes can span dates; splitting them makes their durations and faceted daily displays unambiguous.
start = as.POSIXct("2020-01-01 23:30:00", tz = "UTC") end = as.POSIXct("2020-01-02 00:30:00", tz = "UTC") acti_split_intervals_at_midnight(start, end)start = as.POSIXct("2020-01-01 23:30:00", tz = "UTC") end = as.POSIXct("2020-01-02 00:30:00", tz = "UTC") acti_split_intervals_at_midnight(start, end)
Standardize the Accelerometry Data
acti_standardize_data( data, subset_xyz = TRUE, colname_time = "time", lower_case = FALSE, check_xyz = TRUE ) acti_standardise_data( data, subset_xyz = TRUE, colname_time = "time", lower_case = FALSE, check_xyz = TRUE )acti_standardize_data( data, subset_xyz = TRUE, colname_time = "time", lower_case = FALSE, check_xyz = TRUE ) acti_standardise_data( data, subset_xyz = TRUE, colname_time = "time", lower_case = FALSE, check_xyz = TRUE )
data |
A |
subset_xyz |
should only the |
colname_time |
column name of header for time |
lower_case |
flag to make sure all columns are lower case. |
check_xyz |
Check if X/Y/Z is in the data |
When a complete canonical triplet and a complete prefixed triplet
(acc_* or acceleration_*) are both present, the canonical columns are
used and a single warning is issued. A data frame containing both X and
x (or the analogous pair for Y or Z) is rejected as ambiguous.
A data.frame with X/Y/Z and a time in
time (if available).
acti_standardize_data(acti_raw_data) acti_standardise_data(acti_raw_data)acti_standardize_data(acti_raw_data) acti_standardise_data(acti_raw_data)
Tidy axes to a long format
acti_tidy_axes(data, colname_time = "time")acti_tidy_axes(data, colname_time = "time")
data |
An object with columns a time column |
colname_time |
column name of header for time |
A long data set with time, axis, and value
long = acti_tidy_axes(acti_raw_data)long = acti_tidy_axes(acti_raw_data)
Extract the Time of Day
acti_time_of_day(time, timezone = NULL)acti_time_of_day(time, timezone = NULL)
time |
A |
timezone |
Optional Olson timezone in which to extract time of day. |
An hms vector.
This explicitly applies the recording or requested timezone before dropping the date, which prevents a timestamp from being assigned to the wrong activity-day minute.
time = as.POSIXct("2020-01-01 05:30:00", tz = "UTC") acti_time_of_day(time, timezone = "America/New_York")time = as.POSIXct("2020-01-01 05:30:00", tz = "UTC") acti_time_of_day(time, timezone = "America/New_York")
Convert a Time of Day to a Minute Index
acti_time_to_minute(x, start = 1L, timezone = NULL)acti_time_to_minute(x, start = 1L, timezone = NULL)
x |
An |
start |
The index assigned to midnight, either |
timezone |
Optional Olson timezone for |
An integer minute-of-day index.
This converts each minute of a day to either 0 through 1439 or
1 through 1440, the two common minute-of-day conventions.
acti_time_to_minute(c("00:00", "12:00", "23:59")) acti_time_to_minute("00:00", start = 0)acti_time_to_minute(c("00:00", "12:00", "23:59")) acti_time_to_minute("00:00", start = 0)
Convert vectors ensuring no new NA
as_convert_safe(x, ..., func = lubridate::as_datetime) as_date_safe(x, ...) as_datetime_safe(x, ...)as_convert_safe(x, ..., func = lubridate::as_datetime) as_date_safe(x, ...) as_datetime_safe(x, ...)
x |
a vector |
... |
additional arguments to pass to |
func |
the function to use to transform the vector |
A converted vector the same length as x or errors if there
are introduced NAs.
Create Day-Level Inclusion information
create_day_inclusion(data, min_required = 1368L) add_day_inclusion(data, ...)create_day_inclusion(data, min_required = 1368L) add_day_inclusion(data, ...)
data |
A |
min_required |
Number of minutes required in a day to be called |
... |
arguments to pass to create_day_inclusion when using add_day_inclusion |
A data.frame for each day with information of number of minutes observed
and included
data = acti_raw_data |> dplyr::mutate(r = sqrt(X^2 + Y^2 + Z^2), time = lubridate::floor_date(time, "1 minute")) |> dplyr::group_by(time) |> dplyr::summarise(r = sum(r), .groups = "drop") |> dplyr::mutate(wear = r > 4000) res = create_day_inclusion(data)data = acti_raw_data |> dplyr::mutate(r = sqrt(X^2 + Y^2 + Z^2), time = lubridate::floor_date(time, "1 minute")) |> dplyr::group_by(time) |> dplyr::summarise(r = sum(r), .groups = "drop") |> dplyr::mutate(wear = r > 4000) res = create_day_inclusion(data)
Get Dynamic Range
get_dynamic_range(data, dynamic_range = NULL, flag_estimated = FALSE)get_dynamic_range(data, dynamic_range = NULL, flag_estimated = FALSE)
data |
An |
dynamic_range |
the dynamic range. If this is not |
flag_estimated |
if |
A length-2 numeric vector, or the original dynamic range (no checking done)
Get Sample Rate
get_sample_rate(data, sample_rate = NULL, flag_estimated = FALSE)get_sample_rate(data, sample_rate = NULL, flag_estimated = FALSE)
data |
A data set of actigraphy/activity data |
sample_rate |
the sample rate. If this is not |
flag_estimated |
if |
A length-1 numeric vector
Get Transformations
get_transformations(data) prefix_transformations(transformations, prefix = NULL) set_transformations(data, transformations, add = TRUE, prefix = NULL)get_transformations(data) prefix_transformations(transformations, prefix = NULL) set_transformations(data, transformations, add = TRUE, prefix = NULL)
data |
data set of data, usually time and X/Y/Z. |
transformations |
character string of transformations |
prefix |
if not |
add |
Add the transformations to those already there in |
set_transformations returns the data, with the
transformations attribute updated and set_transformations
returns the attribute transformations
AccData
Is the object of class AccData
is.AccData(x)is.AccData(x)
x |
object to test |
Logical(1)
is.AccData(mtcars)is.AccData(mtcars)
Mark a Condition of a Specified Minimum Length
mark_condition(x, min_length = 1)mark_condition(x, min_length = 1)
x |
A logical vector |
min_length |
minimum length, contiguous |
A logical vector
x = c(FALSE, TRUE, TRUE, FALSE, FALSE, rep(TRUE, 10), FALSE, rep(TRUE, 20)) mark_condition(x) mark_condition(x, 2) mark_condition(x, 5) mark_condition(x, 15)x = c(FALSE, TRUE, TRUE, FALSE, FALSE, rep(TRUE, 10), FALSE, rep(TRUE, 20)) mark_condition(x) mark_condition(x, 2) mark_condition(x, 5) mark_condition(x, 15)
Strip Hour Shift from Character Time Vector
strip_hour_shift(x, max_index = 2L)strip_hour_shift(x, max_index = 2L)
x |
character vector with times that may include hour shifts (e.g., "2019-01-01 12:00+03:00") |
max_index |
maximum index to grab the shift from after splitting on spaces, default is 2 (e.g., "2019-01-01 12:00") |
A character vector with the +/- hour shift removed
strip_hour_shift(c("2019-01-01 12:00+03:00", "2019-01-01 12:00-04:00"))strip_hour_shift(c("2019-01-01 12:00+03:00", "2019-01-01 12:00-04:00"))
Vector of X, Y, Z, and maybe time
xyz xyzt txyzxyz xyzt txyz
A vector with 3 or 4 elements, which are:
value to extract X column
value to extract Y column
value to extract Y column
value to extract time column
An object of class character of length 4.
An object of class character of length 4.