select_relevant_rows.RdThis 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.
select_relevant_rows(data, timestamp, net_cfg)
| data | a data frame |
|---|---|
| timestamp | the date of the first measurement in the format |
| net_cfg | a net_cfg object providing metadata about the networks |
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).
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#> id tijdstip something #> 1 NA NA NA #> 2 NA NA NA #> 3 NA NA NA #> 4 1 3 9 #> 5 1 4 16 #> 6 NA NA NAnet_cfg <- new_net_cfg() net_cfg$measurements_per_day <- 2 select_relevant_rows(data,'2014-05-06',net_cfg)#> $data #> id tijdstip something #> 4 1 3 9 #> 5 1 4 16 #> #> $first_measurement_index #> [1] 2 #> #> $timestamp #> [1] "2014-05-07" #>