From taplate at gmail.com  Wed May  5 17:59:50 2010
From: taplate at gmail.com (Tony Plate)
Date: Wed, 05 May 2010 11:59:50 -0400
Subject: [Rd] Generate NA of specified type
In-Reply-To: <h2gf8e6ff051005050857tfe7d7566m797b3abbad5f429c@mail.gmail.com>
References: <h2gf8e6ff051005050857tfe7d7566m797b3abbad5f429c@mail.gmail.com>
Message-ID: <4BE195F6.70804@acm.org>

I just do as.integer(NA), as.numeric(NA), as.character(NA), etc.
-- Tony Plate

On 5/5/2010 11:57 AM, Hadley Wickham wrote:
> Hi all,
>
> Is there an existing function that provides the correct type of
> missing value for a given vector? e.g.
>
> NAof(1:3) # NA_integer_
> NAof(pi) # NA_real_
> NAof("a") # NA_character_
> NAof(T) # NA
>
> ?
>
> Thanks,
>
> Hadley
>
>



[Rd] Generate NA of specified type
Tony Plate