import_survey {iNZightTools} | R Documentation |
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
import_survey(file, data)
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 |
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.
a inzsvyspec
object containing the design parameters and, if data supplied,
the created survey object
Tom Elliott