select_relevant_rows: Select and return the relevant rows

View source: R/select_relevant_rows.r

select_relevant_rowsR Documentation

Select and return the relevant rows

Description

This function returns the data frame with the beginning and trailing rows that are all NA removed, it also returns updated first_measurement_index and timestamp variables. The timestamp may advance as a result of the data frame starting with three or more NA's.

Usage

select_relevant_rows(data, timestamp, net_cfg)

Arguments

data

a data frame

timestamp

the date of the first measurement in the format 'yyyy-mm-dd'

net_cfg

a net_cfg object providing metadata about the networks

Value

This function returns a list with three elements, data is the modified data frame, first_measurement_index is the possibly adjusted first_measurement index, and timestamp is the possibly updated timestamp (day).

Examples

data <- data.frame(id=c(NA,NA,NA,1,1,NA),tijdstip=c(NA,NA,NA,3,4,NA),something=c(NA,NA,NA,9,16,NA))
data
net_cfg <- new_net_cfg()
net_cfg$measurements_per_day <- 2
select_relevant_rows(data,'2014-05-06',net_cfg)

roqua/autovar documentation built on Jan. 21, 2023, 7:37 p.m.