removeLastIncompleteRecord: removeLastIncompleteRecord

Description Usage Arguments Details Value Author(s) Examples

View source: R/updateOutputRange.R

Description

remove last row, if its timestep does not match (second - first row)

Usage

1
removeLastIncompleteRecord(data, colTimestamp = "timestamp")

Arguments

data

the data.frame to check

colTimestamp

scalar sting column name holding the time steps

Details

Expects the timestamp column to hold end-of period timestamps with no missings. If the timestep is smaller than the first, this indicates that the data of the last time step was not complete yet. This method checks on this condition and removes an incomplete last row.

Value

data with last row removed, if the time step is incomplete

Author(s)

Thomas Wutzler

Examples

1
2
3
4
5
6
7
nRec <- 10
dsComplete <- data.frame(date = seq(
  ISOdatetime(2010,1,1,0,0,30, tz = "UTC"), by = "30 min", length.out = nRec))
dsIncomplete <- dsComplete
dsIncomplete$date[nRec] <- dsIncomplete$date[nRec] - 2*60
nrow( removeLastIncompleteRecord(dsComplete, "date") )
nrow( removeLastIncompleteRecord(dsIncomplete, "date") )

bgctw/equidIO documentation built on Nov. 17, 2020, 5:05 a.m.