vector or
bdVector of data to be edited. Missing values (
NAs) are
allowed.
list
vector or
bdVector of the indices of the elements in
x to be replaced.
values
vector or
bdVector of values to replace the list of elements, or to be
appended after the
after position. If
values is shorter
than
list, it is re-used cyclically; if it is longer, a warning is given. Missing values (
NAs)
are allowed.
OPTIONAL ARGUMENTS:
after
index in
x after which
values are appended. If
after=0,
values are placed at the beginning.
VALUE:
the edited vector or
bdVector, to be assigned back to
x, or used in
any other way.
Remember, unless the result is assigned back to
x,
x will
not be changed.
SEE ALSO:
to concatenate vectors or
bdVectors.
EXAMPLES:
# replace x[3] with 1.5
x <- replace(x,3,1.5)
# alternative: replaces x[3] with 1.5
x[3]<-1.5
# append two values in x[7],x[8]
x <- append(x,c(3.4,5.7),6)
# replace the four elements with 0
y <- replace(x,c(3,7,8,9),0)