The "+" supports numeric
, integer
and Date
in r
. All below operations are valid.
> 5 + 5L
[1] 10
> Sys.Date() + 5
[1] "2018-01-18"
But +
doesn't work between character
. Like:
> "one" + "one"
Error in "one" + "one" : non-numeric argument to binary operator
> "What is date today? Ans:" + Sys.Date()
Error in unclass(e1) + unclass(e2) :
non-numeric argument to binary operator
Is it forbidden to allow other than numeric
argument in r
? Or someone can overwrite +
behavior to support other types of argument.