import_survey {iNZightTools}R Documentation

Import survey information from a file

Description

The survey information should be in TOML format, with fields corresponding to survey design components. For example,

strata = strata_var
clusters = cluster_var
weights = wt_var

Usage

import_survey(file, data)

Arguments

file

the file containing survey information (see Details)

data

optional, if supplied the survey object will be created with the supplied data. Can be either a data.frame-like object, or a path to a data set which will be imported using iNZightTools::smart_read.

Details

For replicate weight designs, vectors (if necessary) are declared with square brackets, like so:

repweights = ['w01', 'w02', 'w03', 'w04', ..., 'w20']

although this would be better expressed using a regular expression,

repweights = '^w[0-2]'

which matches all variables starting with a w followed by digits between 0 and 2 (inclusive).

Additionally, the information can contain a file specification indicating the path to the data, which will be imported using iNZightTools::smart_read if it exists in the same directory as file, or alternatively a URL to a data file that will be downloaded.

Value

a inzsvyspec object containing the design parameters and, if data supplied, the created survey object

Author(s)

Tom Elliott


[Package iNZightTools version 1.12.2 Index]