set_mw<- {optimall}R Documentation

Write Slots of a Multiwave Object

Description

set_mw is used to assign values (write to) slots of Multiwave class objects. It is used to set values of multiwave (mw) objects.

Usage

set_mw(
  x,
  phase = 1,
  wave = NA,
  slot = c("data", "design", "metadata", "samples", "sampled_data")
) <- value

Arguments

x

an object of class 'Multiwave'

phase

a numeric value specifying the phase that should be accessed. To access the overall metadata, set phase = NA. Defaults to 1.

wave

a numeric value specifying the wave that should be accessed. Ta access phase metadata, set wave = NA. Defaults to NA.

slot

a character value specifying the name of the slot to be accessed. Must be one of "metadata", "design", "samples", "sampled_data", "data". Defaults to "data". See class documentation or package vignettes for more information about slots.

value

value to assign to specified slot

Examples

# Intiate multiwave object
MySurvey <- multiwave(phases = 2, waves = c(1, 3))

# To write overall metadata
set_mw(MySurvey, phase = NA, slot = "metadata") <-
 list(title = "Maternal Weight Survey")

# To write Phase 2 metadata
set_mw(MySurvey, phase = 2, slot = "metadata") <-
 list(strata = "mystrata", id = "id")


[Package optimall version 1.1.1 Index]