[R] learning R

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Wed Feb 25 10:48:24 CET 2009

markleeds at verizon.net wrote:
>  Hi Wacek: Somewhere I remember reading that environments have
> functionality like lists EXCEPT for the names part. IIRC, I think that
> I read this in the R Language Reference manual also.

this would be a confused and confusing statement, unless 'functionality'
has some rather vague sense here.  (which would not be very
surprising.)  if you find it, i humbly suggest that you politely report
it as a statement to be fixed.

there are important differences between environments and lists, in
particular wrt. to assignment:

    l = list(a=1)
    ll = l
    l$a = 0
    l$a == ll$a
    # FALSE

    e = new.env()
    e$a = 1
    ee = e
    e$a = 0
    e$a == ee$a
    # TRUE

this is a fundamental difference, one that could/should be more
carefully acknowledged in functions that return objects represented with
environments as opposed to lists (e.g., srcfile).


More information about the R-help mailing list