gss_identify_vintage: Identify the vintage of a set of GSS codes

Description Usage Arguments Value Examples

View source: R/gss_identify_vintage.R

Description

Given a data frame or a vector containing GSS codes, return a list with values of the earliest and latest dates all input codes were valid, plus other data.

Usage

1
gss_identify_vintage(data, col_gss = "gss_code", test_vintage = NULL)

Arguments

data

A vector of GSS codes or a data frame.

col_gss

If data is a data frame, the name of the column containing gss_codes.

test_vintage

Either NULL, a year, or a date giving the hypothesised vintage of the data. The returned list contains elements confirming whether this vintage is compatible with the input data. When this is provided as a year, it is assumed to be December 31 of that year, the date usually referred to by single-year vintages.

Value

A list with several elements: vintage_start is the earliest date compatible with the input data, and vintage_end is the latest. vintage_years is a vector of years where the 31 December is within the interval between vintage_start and vintage_end. vintage_current is a boolean indicating whether the data is current. test_vintage is the date given by the input parameter test_vintage and test_valid is a boolean denoting whether the vintage is consistent with the input data. When no vintage is consistent with these data these parameters take NA.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
  # Find the vintage of the City of London
  gss_identify_vintage("E09000001")

  # Check the wards in a data frame are consistent
  x <- data.frame(name = c("a", "b"),
                  gss_code = c("E05000610", "E05000615"))
  gss_identify_vintage(x, col_gss = "gss_code", test_vintage = 2011)

## End(Not run)

ChrisFairless/geograpi documentation built on July 4, 2020, 12:01 a.m.