parse_censored_data_edfacts: Parse censored data in the form used by EdFacts.

Description Usage Arguments Details Value Note

View source: R/parse-censored-data.R

Description

You have numeric data stored like 75-80, GE75, LE25, LT50 etc. You want to replace with the midpoints (a common approach). This function does this parsing.

Usage

1
parse_censored_data_edfacts(vect, maxnum = 100, minnum = 0)

Arguments

vect

character vector to parse

maxnum

maximum for purposes of GE and GT

minnum

minimum for purposes of LE and LT

Details

In particular the censored data looks like this:

* numbers are like 75-80, with a dash in the middle meaning that it is somewhere in that range; or

* numbers are like GE75, meaning >=75

* numbers are like LE25, meaning <=25

* numbers are like LT50, meaning <50 (effectively the same as <=50 and treated as such here)

Given a character vector, this function returns a numeric vector that:

* returns the midpoint of things that look like 75-80 e.g.;

* returns (maxnum+75)/2 for GE75 e.g.;

* returns (minnum+25)/2 for LE25 e.g.

Value

numeric vector of parsed data (with NA where the parse failed)

Note

The name of the function will hopefully prevent conflicts with other packages but the method is probably more general than edfacts data.


rdisalv2/dismisc documentation built on Nov. 2, 2021, 1:34 a.m.