Mike Williamson <this.is....@gmail.com> writes:

> Thanks Sarah, All,
>
>     I guess I never thought of a negative sign as an "operation", but
> knowing that it is considered an operation explains everything nicely.
>  Somewhere in it's underbelly, I suppose -4 is represented as "0 - 4"?

Not exactly. Here is the list of constituent elements of expressions for -1 and 
0 - 1

> as.list(quote(-4))
[[1]]
`-`

[[2]]
[1] 4

> as.list(quote(0-4))
[[1]]
`-`

[[2]]
[1] 0

[[3]]
[1] 4

The first case is unary, the second is binary. 

Exercise: See ?Syntax. Write the result of this line:

          lapply( as.list( quote(-1-4) ), as.list )

and (thereby) explain why the result of -1-4 isn't 3.

HTH,

Chuck

[rest deleted]


-- 
Charles C. Berry                            Dept of Family/Preventive Medicine
cberry at ucsd edu                          UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to