rake: rake

Description Usage Arguments Value Examples

View source: R/rake_functions.R

Description

A convenience function wrapping weight() and extract() or weight() and integerise()

Usage

1
rake(cons, inds, vars, output = "fraction", iterations = 10, ...)

Arguments

cons

A data frame of constraint variables

inds

A data frame of individual–level (survey) data

vars

A character string of variables to iterate over

output

A string specifying the desired output, either "fraction" (extract()) or "integer" (integerise())

iterations

The number of iterations to perform. Defaults to 10.

...

Additional arguments to pass to depending on desired output:

  • if "fraction" specify 'id' (see extract() documentation)

  • if "integer" specify 'method' and 'seed' (see integerise() documentation)

Value

A data frame with extracted weights (if output == "fraction", the default) or integerised cases (if output == "integer")

Examples

1
2
3
4
5
6
## not run
## frac_weights <- rake(cons, inds, vars, output = "fraction",
##                      id = "id")

## int_weight <- rake(cons, inds, vars, output = "integer",
##                    method = "trs", seed = "42")

rakeR documentation built on May 2, 2019, 5:13 a.m.