Skip to content
Back to formatted view

Raw Message

Message-ID: <f8e6ff050809041448j566e8e7dt1375c67bf66abf5a@mail.gmail.com>
Date: 2008-09-04T21:48:24Z
From: Hadley Wickham
Subject: lapply(NULL, ...) returns empty list
In-Reply-To: <22D850BC39A25742977325ADDE208E7702669563E4@chiexchange02.w2k.jumptrading.com>

On Thu, Sep 4, 2008 at 4:01 PM, Vadim Organovich
<vogranovich at jumptrading.com> wrote:
> Dear R-devel,
>
> Is there a reason that lapply(NULL, ...) returns the empty list, rather than NULL? It seems intuitive to expect the latter, and rather counterintuitive that lapply(list(), ... ) returns the same value as lapply(NULL, ...).


  X: a vector (atomic or list) or an expressions vector.  Other
          objects (including classed objects) will be coerced by
          'as.list'.

> as.list(NULL)
list()

Hadley

-- 
http://had.co.nz/