[R] fill a dataframe with zeros where the rows are a smaller subset of a larger dataframe (species by site)

Stephen Sefick sas0025 at auburn.edu
Wed Apr 25 16:42:48 CEST 2012


I am subsetting a larger data frame that contains macroinverterate 
taxa.  I am subsetting them at different levels of taxonomic 
resolution.  Some of the sites do not have say Tipulidae present, so the 
rows are removed completely for this site.  I would like to fill in the 
sites that were removed during the subsetting and fill these with 0.  I 
have the non-subsetted dataframe which contains all of the sites.  I 
would like to use the sites from this complete data set to "expand" the 
dataframe that is a subset of the sites in the original.  Is that more 
clear.

Stephen

On Wed 25 Apr 2012 09:13:24 AM CDT, chuck.01 wrote:
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/fill-a-dataframe-with-zeros-where-the-rows-are-a-smaller-subset-of-a-larger-dataframe-species-by-sit-tp4586534p4586711.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
> -- 
> Stephen Sefick
> **************************************************
> Auburn University
> Biological Sciences
> 331 Funchess Hall
> Auburn, Alabama
> 36849
> **************************************************
> sas0025 at auburn.edu
> http://www.auburn.edu/~sas0025
> **************************************************
>
> Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods.  We are mammals, and have not exhausted the annoying little problems of being mammals.
>
>                                  -K. Mullis
>
> "A big computer, a complex algorithm and a long time does not equal science."
>
>                                -Robert Gentleman
>



More information about the R-help mailing list