removeInvalidDates: Remove Invalid Dates

Description Usage Arguments Value

Description

Some countries have specific date ranges for which they have valid data. For example, Belarus became a country in 1992, and therefore should not have data prior to 1992. If the user attempts to write data to this country at a point in time prior to 1992, an error will occur. This function contains the logic for removing such invalid country/year pairs.

Usage

1
removeInvalidDates(data, context = swsContext.datasets[[1]])

Arguments

data

A data.table object, typically one which has been extracted from the SWS and modified/analyzed.

context

An element of type DatasetKey (which is defined in faosws). This object contains information on the domain and dataset of interest. It defaults to swsContext.datasets[[1]], which should usually be what is desired.

Value

A data.table object whose invalid rows have been removed. Ultimately, this function should work like the other data.table functions: modify the object in place and not return anything. However, row deletion cannot be done without copying in the current data.table framework. This issue is in progress: https://github.com/Rdatatable/data.table/issues/635.


SWS-Methodology/faoswsProcessing documentation built on June 19, 2019, 5:14 p.m.