Dear developers:
I have just came across an (unexpected to me) behaviour of lists when
assigning NULLs to list elements. I understand that a NULL is a valid R
object, thus assigning a NULL to a list element should yield exactly the
same result as assigning any other object. So I was surprised w
On Tue, 12 Feb 2008, Oleg Sklyar wrote:
> Dear developers:
>
> I have just came across an (unexpected to me) behaviour of lists when
> assigning NULLs to list elements. I understand that a NULL is a valid R
> object, thus assigning a NULL to a list element should yield exactly the
> same result as
>From your tone, I gather you don't much like this behavior, and I can see your
point, as it not very intuitive that setting a list element to NULL deletes
any existing element at that index. But is there a better way to delete an
element from a list? Maybe there should be.
Jeff
Prof Brian Rip
Oleg Sklyar wrote:
> Dear developers:
>
> I have just came across an (unexpected to me) behaviour of lists when
> assigning NULLs to list elements. I understand that a NULL is a valid R
> object, thus assigning a NULL to a list element should yield exactly the
> same result as assigning any oth
On Tue, 12 Feb 2008, Oleg Sklyar wrote:
> Dear developers:
>
> I have just came across an (unexpected to me) behaviour of lists when
> assigning NULLs to list elements. I understand that a NULL is a valid R
> object, thus assigning a NULL to a list element should yield exactly the
> same result as
On Tue, Feb 12, 2008 at 11:06:59AM +, Oleg Sklyar wrote:
> Dear developers:
>
> I have just came across an (unexpected to me) behaviour of lists when
> assigning NULLs to list elements. I understand that a NULL is a valid R
> object, thus assigning a NULL to a list element should yield exact
:) Well, yes, but what do you do with a named vector if you want to
remove an element by name?
It is not general: you cannot do that on vectors, matrices, arrays and
all inherited objects anyway. Using a negative index is a standard and
throughout practice of deleting elements in R. Surely one
But what about by name?
a <- list(a = 1, b = 2, c = 3)
a$b <- NULL
On Feb 13, 2008 9:39 AM, Oleg Sklyar <[EMAIL PROTECTED]> wrote:
> Hmm, I think the pretty traditional R style does the job...
>
> a = list(1,2,3)
> a[-2]
>
> So I really do not see a good reason for doing a[2] = NULL instead of
Hmm, I think the pretty traditional R style does the job...
a = list(1,2,3)
a[-2]
So I really do not see a good reason for doing a[2] = NULL instead of a
= a[-2]
Jeffrey J. Hallman wrote:
>>From your tone, I gather you don't much like this behavior, and I can see your
> point, as it not very in