[R] Joining Dataframes

From: Matt Goff <goff_at_nawwal.org>
Date: Wed 05 Oct 2005 - 05:37:07 EST

I am attempting to join several dataframes that summarize sampling effort for different samples into one large data.frame/table. I have looked at the merge command, but have not been clever enough to figure out how to get it to do what I want.

A simplified example of what I am trying to do:

The dataframes I have look like this (they were generated using the table command)

species1.effort

            site1   site2   site3
date1     5        5       5
date2     4        5       5
date3     4        5       5

species2.effort
            site1   site2   site3
date1     7        8        6
date3     8        7        8
date4     8        8        8

I would like to join these into a table that looks something like this:

Effort

             sp1.site1 sp1.site2 sp1.site3 sp2.site1 sp2.site2 sp2.site2

date1         5               5          5             7              
8            6
date2         4               5          5            NA           
NA         NA
date3         4               5           5           8              
7             8
date4         NA           NA        NA         8            8              
8

I have many more dates and species, but I assume whatever method works for this small example, would work for larger cases.

Thanks,
Matt Goff



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Oct 05 05:57:49 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:35 EST