Skip to content
Back to formatted view

Raw Message

Message-ID: <49A513E8.40800@idi.ntnu.no>
Date: 2009-02-25T09:48:24Z
From: Wacek Kusnierczyk
Subject: learning R
In-Reply-To: <589927733.6635181235554767208.JavaMail.javamailuser@localhost>

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).

vQ