[R] fill 0-row data.frame with 1 line of NAs

Liviu Andronic landronimirc at gmail.com
Wed Jul 11 08:58:50 CEST 2012


On Tue, Jul 10, 2012 at 4:53 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
> Both this and Liviu's original solution destroy the
> factor nature of 'Species' (which may not matter, of
> course). How about
>
>
>   (.xb <- iris[ iris$Species=='zz', ])
>   .xb <- .xb[1, ]   # this probably shouldn't work, but it does.
>
This one is an excellent solution, but yet another---what I
call---quirky behaviour from R.

Thanks all! Regards
Liviu



More information about the R-help mailing list