From h.wickham at gmail.com  Thu Sep  4 23:48:24 2008
From: h.wickham at gmail.com (hadley wickham)
Date: Thu, 4 Sep 2008 16:48:24 -0500
Subject: [Rd] lapply(NULL, ...) returns empty list
In-Reply-To: <22D850BC39A25742977325ADDE208E7702669563E4@chiexchange02.w2k.jumptrading.com>
References: <22D850BC39A25742977325ADDE208E7702669563E4@chiexchange02.w2k.jumptrading.com>
Message-ID: <f8e6ff050809041448j566e8e7dt1375c67bf66abf5a@mail.gmail.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/



[Rd] lapply(NULL, ...) returns empty list
hadley wickham