get_mw {optimall} | R 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 |
phase |
a numeric value specifying the phase that should be accessed.
To access the overall metadata, set |
wave |
a numeric value specifying the wave that should be accessed.
Ta access phase metadata, set |
slot |
a character value specifying the name of the slot to be
accessed. Must be one of |
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")