Combine Values into a Vector or List

DESCRIPTION:

Concatenates objects into a vector, a bdVector, or a list. Usually, the result is a list if one or more of the objects; otherwise, a vector or a bdVector.

USAGE:

c(..., recursive=F) 

REQUIRED ARGUMENTS:

...
any S-PLUS objects. Missing values ( NAs) are allowed. The name of arguments of length 1 become part of the names of the resulting vector or bdVector.

OPTIONAL ARGUMENTS:

recursive
indicates whether the combining should be done recursively.

VALUE:

vector, bdVector, or list that is the combination of all values from all arguments to the function. If recursive is TRUE, arguments with recursive modes are effectively unlisted (see unlist) before they are used. The mode of the result is the most general of all the modes in the arguments (or the unlisted arguments, if recursive=TRUE). In particular, list objects can be combined this way. The names attribute of the result will be generated from the argument names, if any, plus the names of the combined objects. See unlist for the rule used. Attributes of objects that are bound with other objects are deleted.

DETAILS:

Arguments that are NULL or length 0 do not contribute elements to the result.

Note that c(...,recursive=r) is equivalent to unlist(list(...), recursive=r).

SEE ALSO:

, , , .

EXAMPLES:

c(1:10, 1:5, 1:10) 
c(2, 3, 5, 7, 11, 13) 
c(a=1,b=2)  # vector with names "a" and "b" 
c(states, "Washington DC") 
# a list of 4 numeric vectors 
c(list(1:3, a=3:6), list(8:23, c(3, 8, 39))) 
# a numeric vector of length 26 
c(list(1:3, a=3:6), list(8:23, c(3, 8, 39)), recursive=T) 
# build x, element by element 
# useful if final length not known in advance 
x <- numeric(0) 
for(i in possibles) 
  if(test(i)) x <- c(x, fun(i))