[Rd] Generate NA of specified type
Gabor Grothendieck
ggrothendieck at gmail.com
Wed May 5 18:41:47 CEST 2010
Try this:
replace(x[1][], TRUE, NA)
or
replace(x[[1]][], TRUE, NA)
depending on what you want.
On Wed, May 5, 2010 at 11:57 AM, Hadley Wickham <hadley at rice.edu> 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
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
More information about the R-devel
mailing list