add | R Documentation |
This function adds two objects. If both objects are numeric vectors,
it performs element-wise addition. If one or both objects are strings,
it concatenates them. For other objects, it attempts to use the +
method defined for the class of the objects.
add(x, y)
x |
An object. |
y |
An object. |
The result of adding the two objects.
# Add two numeric vectors
add(c(1, 2, 3), c(4, 5, 6))
# Concatenate two strings
add("hello", "world")
# Add a number and a string (concatenation)
add(1, " world")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.