recover_na: Recovers NA-values in data

Description Usage Arguments Value

View source: R/recover_na.R

Description

Using information disaggregated at different levels recovers protected information: NAs in cells that would otherwise have values 1-4. Options to impute NA-values that cannot be perfectly recovered.

Usage

1
2
3
4
5
6
7
8
9
recover_na(
  alaluokkadata,
  ylaluokkadata,
  alaluokka,
  ylaluokka,
  muuttuja,
  onlyAccurate = FALSE,
  randomizeRest = FALSE
)

Arguments

alaluokkadata

data.frame, contains the data for which NAs are to be recovered.

ylaluokkadata

data.frame, contains the date on one aggregation level above. This data contains the additional information that is used to recovers NAs.

alaluokka

character, is the name of the aggregation class in alaluokkadata and ylaluokkadata.

ylaluokka

character, is the name of the aggregation class in ylaluokkadata and alaluokkadata.

muuttuja

character, is the name of the variable for which NAs are to be recovered.

onlyAccurate

logical, if TRUE, only replaces NA-values that can be recovered accurately. Otherwise see randomizeRest. Defaults to FALSE.

randomizeRest

logical, if TRUE, randomizes a value from 1:4 for those NA-values that cannot be accurately recovered. If FALSE, evenly allocates the missing values as inferred from ylaluokkadata to replace NA-values.

Value

data.frame Output is a data.frame alaluokkadata with NAs recovered.


pttry/statfiLaborMarkets documentation built on March 3, 2021, 8:35 p.m.