midnight_to_midnight: Expand activity data vector into midnight-to-midnight format

Description Usage Arguments Details Value Examples

View source: R/midnight_to_midnight.R

Description

Expand activity data vector such that its length is a multiple of number of minutes in a full day (1440).

Usage

1
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 acc.

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:50-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

1
2
3
4
5
6
7
8
9
## Read exemplary data
fpath_i <- system.file("extdata", extdata_fnames[1], package = "arcstats")
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

martakarass/arcstats documentation built on Sept. 10, 2020, 5:29 a.m.