Learn R Programming

svMisc (version 0.9-60)

addTemp: Add data to an item in a temporary list variable

Description

The function adds data to an item in a list variable located in TempEnv, an environment dedicated to temporary variables (especially useful for GUIs).

Usage

addTemp(x, item, value, use.names = TRUE, replace = TRUE)

Arguments

x
the name of the variable containing the list.
item
the item to add data to in the list.
value
the value to add in the item, it must be a named vector and element matching is done according to name of items.
use.names
do we match items in the existing vector and the vector we add by means of its names or its values?
replace
do we replace existing items?

concept

temporary variables

See Also

TempEnv, assignTemp, getTemp, existsTemp, rmTemp, changeTemp, tempvar

Examples

Run this code
addTemp("tst", "item1", c(a = 1, b = 2))
## Retrieve this variable
getTemp("tst")
## Add to item1 in this list without replacement
addTemp("tst", "item1", c(a = 45, c = 3), replace = FALSE)
getTemp("tst")
## Same but with replacement of existing items
addTemp("tst", "item1", c(a = 45, c = 3), replace = TRUE)
getTemp("tst")
## Delete the whole variable
rmTemp("tst")

Run the code above in your browser using DataLab