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

hadley wickham h.wickham at gmail.com
Thu Sep 4 23:48:24 CEST 2008


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/



More information about the R-devel mailing list