From gunter.berton at gene.com  Thu Oct  4 15:40:31 2012
From: gunter.berton at gene.com (Bert Gunter)
Date: Thu, 4 Oct 2012 06:40:31 -0700
Subject: [Rd] How to build a list with missing values? What is missing,
	anyway?
In-Reply-To: <1349331704206-4644965.post@n4.nabble.com>
References: <CAJoaRhb8gq79aB3EXPeMa+n6eK6pj9NTFHFBJRUbP_=S1bbTaA@mail.gmail.com>
	<1349331704206-4644965.post@n4.nabble.com>
Message-ID: <CACk-te25RZaj8f_TqLW1WLmqFKv5KV_jciVKjyv1xqqPGiw+qA@mail.gmail.com>

Why not just use the list constructor:

theList <- setNames(vector("list",3),letters[1:3])

## The list components are empty = NULL, not NA)

This also doesn't seem to be an R-devel topic.

-- Bert

On Wed, Oct 3, 2012 at 11:21 PM, Josh O'Brien <joshmobrien at gmail.com> wrote:
>
>>Say I have argnames <- c("a", "b", "c").
> >From that I want to construct the equivalent of alist(a=, b=, c=).
>
> Here's a one liner that'll do that for you:
>
> argnames <- letters[1:3]
> setNames(rep(list(bquote()), length(argnames)), argnames)
>
> - Josh
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/How-to-build-a-list-with-missing-values-What-is-missing-anyway-tp4644957p4644965.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



[Rd] How to build a list with missing values? What is missing, anyway?
Bert Gunter