[R] Excluding all missing values with dcast ("reshape2" package)

Jessica Streicher j.streicher at micromata.de
Mon Dec 3 17:53:23 CET 2012


This is not a reproducible example ;)

anyways, dcast has an attribute:
drop	
should missing combinations dropped or kept?

does that not do what you want?

On 03.12.2012, at 16:07, Michael.Laviolette at dhhs.state.nh.us wrote:

> 
> Hello--I'm doing a simple crosstab using dcast:
> 
> rawfreq <- dcast(nh11brfs, race3~CHCCOPD, length)
> 
> with the results
> 
>               race3 Yes   No NA
> 1 White non-Hispanic 446 5473 21
> 2 Other non-Hispanic  29  211  0
> 3           Hispanic   6   81  1
> 4               <NA>  10   83  1
> 
> How would I modify this call to exclude all missing values; that is, to
> obtain
> 
>               race3 Yes   No
> 1 White non-Hispanic 446 5473
> 2 Other non-Hispanic  29  211
> 3           Hispanic   6   81
> 
> Apologies if this has come up before, and thanks.
> 
> -M.L.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list