midnight_to_midnight {arctools} | R Documentation |
Expand activity data vector into midnight-to-midnight format
Description
Expand activity data vector such that its length is a multiple of number of minutes in a full day (1440).
Usage
midnight_to_midnight(acc, acc_ts)
Arguments
acc |
A numeric vector. A minute-level activity counts data vector. |
acc_ts |
A POSIXct vector. Time of activity data collection, corresponding to
|
Details
In the returned vector,
1st observation
corresponds to minute of 00:00-00:01 on the first day of data collection,
and last observation
corresponds to minute of 23:59-00:00 on the last day of data collection.
Entries corresponding to no data in original activity data vector
are filled with NA
.
Value
A numeric vector. A minute-level activity counts data vector in midnight-to-midnight format.
Examples
## Read exemplary data
fpath_i <- system.file("extdata", extdata_fnames[1], package = "arctools")
dat_i <- as.data.frame(data.table::fread(fpath_i))
acc <- dat_i$vectormagnitude
acc_ts <- lubridate::ymd_hms(dat_i$timestamp)
## Get acc data vector in "midnight_to_midnight" format
acc <- midnight_to_midnight(acc, acc_ts)
## Observe we have an integer number of days
length(acc) / 1440
[Package arctools version 1.1.6 Index]