These functions return a logical vector flagging the rows of an input
move2 or data.frame that contain sample data for the specified sensor.
These are the rows that will be used to build IMU bursts when calling
as_acc(), as_mag(), or as_gyro().
Usage
acc_sample_rows(x, colset = NULL)
mag_sample_rows(x, colset = NULL)
gyro_sample_rows(x, colset = NULL)Arguments
- x
A
move2ordata.frame.- colset
An
imu_colsetobject or list ofimu_colsetobjects specifying the columns to check for IMU data. By default, all active colsets detected inxare considered (seeactive_acc_colsets()).
Value
A logical vector the same length as nrow(x). TRUE values
indicate rows where IMU data is present under at least one active colset.
Details
If x has data in more than one active IMU column set, *_sample_rows()
will return TRUE. However, these rows cannot be parsed by as_acc(),
as_mag(), etc. as they contain duplicated IMU data. To ensure that
*_sample_rows() only considers certain column sets, use the colset
argument.
If no active colset is detected (e.g. data with only GPS records),
*_sample_rows() returns FALSE for all rows.
For expanded-format data (where multiple rows compose a single burst)
all rows that contain IMU data are flagged TRUE. However, the output
of as_*() will not necessarily return bursts at each of these locations,
as multiple of these rows will be combined into a single burst.
See also
as_acc(), as_mag(), as_gyro() to extract IMU data from a
move2 or data.frame.
active_acc_colsets(), active_mag_colsets(), active_gyro_colsets()
to inspect which colsets are detected in x.
Examples
alb <- albatrosses()
head(acc_sample_rows(alb))
#> [1] FALSE TRUE TRUE TRUE TRUE TRUE
# Filter to rows with acc data without building bursts
nrow(alb[acc_sample_rows(alb), ])
#> [1] 45