bdCharacter
which is the result of pasting corresponding
elements of the input vectors or
bdVector
s together. If the
collapse
argument is used,
a single string is returned.
paste(..., sep=" ", collapse=NULL)
bdVector
s that can be either numeric, logical, complex, or character.
All arguments are coerced to mode character.
Missing values (
NA
s) are allowed.
""
for no space. The default is a single space.
bdCharacter
, with length equal to the maximum
of the lengths of the arguments
(unless
collapse
is given, in which case
the length is 1).
The
i
-th element of the
result is the concatenation of the
i
-th elements of the
arguments. If
the length of any argument is less than the maximum,
elements of that argument are repeated cyclically. In
particular, an argument can be a single element, to appear
in each element of the result.
If
collapse
is given, all of the strings
produced are finally collapsed into one long string with the
collapse
string inserted between elements.
paste("no.",1:10) # gives "no. 1", "no. 2" ... outer(month.name, 2001:2003, paste) # each month-year combination is produced paste(1:10,collapse="") # produces "12345678910" paste(state.name,"pop =", state.x77[,"Population"]) # "Alabama pop = 3615"...
# The following shows how to use levels of a factor in a call to paste. > data.class(fuel.frame$Type) [1] "factor" > paste( "one", fuel.frame$Type[13:14], "auto" ) [1] "one 4 auto" "one 5 auto" > paste( "one", as.character(fuel.frame$Type[13:14]), "auto" ) [1] "one Small auto" "one Sporty auto"