addItems: Add items from one vector to another one with or without...

Description Usage Arguments Author(s) See Also Examples

View source: R/addItems.R

Description

The function takes the (named) items of one vector and place them in a second vector if these names do not exist yet there, or replace corresponding content otherwise.

Usage

1
2
3
4
5
addItems(x, y, use.names = TRUE, replace = TRUE)
addActions(obj = ".svActions", text = NULL, code = NULL, state = NULL,
	options = NULL, replace = TRUE)
addIcons(obj = ".svIcons", icons, replace = TRUE)
addMethods(methods)

Arguments

x

the vector to add items to.

y

the vector of which we want to inject missing items in 'x'.

use.names

use names of items to determine which one is unique, otherwise, the selection is done on the items themselves.

replace

do we replace existing items in 'x'?

obj

the name of the object in SciViews:TempEnv to manipulate.

text

the text of actions to add (label on first line, tip on other lines).

code

the R code of actions to add.

state

the default (strating) state of an action, as a succession of letters: \"c\" = checked, \"u\" = unchecked (default); \"d\" = disabled, \"e\" = enabled (default); \"h\" = hidden, \"v\" = visible (default). Default values are facultative. Ex: udv means: unchecked - disabled - visible and it equals to simply d.

options

a character vector with other options to pass to the graphical toolkit for this action.

icons

a named character vector matching names of actions/panels with the URL or file name of icon resources accessible by the GUI client.

methods

the methods to add to getOption("svGUI.methods"). This information is used to compute a list of possible methods for a given object, for instance, in the context menu of an object explorer (see objMenu()).

Author(s)

Philippe Grosjean <[email protected]>

See Also

listMethods, objMenu, TempEnv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## I have a vector v1 with this:
v1 <- c(a = "some v1 text", b = "another v1 text")
## I want to add items whose name is missing in v1 from v2
v2 <- c(a = "v2 text", c = "the missign item")
addItems(v1, v2, replace = FALSE)
## Not the same as
addItems(v1, v2, replace = TRUE)
## This yield different result (names not used and lost!)
addItems(v1, v2, use.names = FALSE)

## This is useful to add actions, icons, descriptions, shortcuts or methods
## TODO: examples and use for functions addActions(), addIcons() and
## addMethods()

svMisc documentation built on May 29, 2017, 12:18 p.m.