Ron,
In arithmetic, '-' and '+' are binary _and_ unary operators. That is,
both -1 and 1-1 are valid arithmetic expressions, the former negates its
argument, and the latter subtracts the second from the first. Since much
of R is designed do arithmetic, R honors the unary _and_ binary versions
of '
On Sun, Aug 1, 2010 at 7:56 AM, Ron Michael wrote:
> Hi friends, I am aware of the function "-"() which acts as minus in ordinary
> computations. For example:
>
>> "-"(3, 1)
> [1] 2
>
> However what is the meaning of
>> "-"(3)
> [1] -3
This seems quite functionally useful; consider the behavior
well
"*"(3,2) works but "*"(3,2,3) does not. You should now be able to
figure out the logic. It is related to the number of arguments that
make sense.
Nikhil Kaza
Asst. Professor,
City and Regional Planning
University of North Carolina
nikhil.l...@gmail.com
On Aug 1, 2010, at 10:56 AM, R
Hi friends, I am aware of the function "-"() which acts as minus in ordinary
computations. For example:
> "-"(3, 1)
[1] 2
However what is the meaning of
> "-"(3)
[1] -3
I was expecting R to generate some error as it does for "*"(3). What is the
logic for that calculation?
Thanks,
4 matches
Mail list logo