add {FastUtils} | R Documentation |
Add Two Objects
Description
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.
Usage
add(x, y)
Arguments
x |
An object. |
y |
An object. |
Value
The result of adding the two objects.
Examples
# 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")
[Package FastUtils version 0.1.1 Index]