get_mw: Access Slots of a Multiwave Object

get_mwR Documentation

Access Slots of a Multiwave Object

Description

get_mw is the accessor function for objects of class Multiwave. It is used to get values from multiwave (mw) objects.

Usage

get_mw(
  x,
  phase = 1,
  wave = NA,
  slot = c("data", "design", "metadata", "samples", "sampled_data")
)

get_data(
  x,
  phase = 1,
  wave = NA,
  slot = c("data", "design", "metadata", "samples", "sampled_data")
)

get_data(
  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

Value

If accessing a multiwave object slot, returns the specified slot.

Functions

  • get_mw(): access slot of multiwave object

  • get_data(): access slot of multiwave object

  • get_data( x, phase = 1, wave = NA, slot = c("data", "design", "metadata", "samples", "sampled_data") ) <- value: assign value to slot of a multiwave object

Examples

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

# To access overall metadata
get_mw(MySurvey, phase = NA, slot = "metadata")

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

# To access Phase 2 metadata
get_mw(MySurvey, phase = 2, slot = "metadata")

# To access Phase 2, Wave 2 design
get_mw(MySurvey, phase = 2, wave = 2, slot = "design")

optimall documentation built on June 22, 2024, 9:34 a.m.