[R] merging multiple data frames with different numbers of rows

From: stephen sefick <ssefick_at_gmail.com>
Date: Tue, 29 Apr 2008 10:42:48 -0400

merge can only merge two objects at a time- I would like to merge more than two objects at a time.

s.d <- structure(list(RiverMile = c(202L, 198L, 190L, 185L, 179L, 148L, 119L, 61L)), .Names = "RiverMile", row.names = c(NA, -8L), class =

#s.d is all of the river miles that can occur in all of the data frames that

I want to put together

feb06 <- structure(list(RiverMile = c(202L, 190L, 185L), X2.1.06 = c(2850000,
NA, NA)), .Names = c("RiverMile", "X2.1.06"), row.names = c(29L, 31L, 32L), class = "data.frame")

may06 <- structure(list(RiverMile = c(202L, 198L, 190L, 185L, 148L), X5.1.06

jun06 <- structure(list(RiverMile = c(202L, 198L, 190L, 185L, 148L), X6.1.06 = c(NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_)), .Names = c("RiverMile",
"X6.1.06"), row.names = c(29L, 30L, 31L, 32L, 34L), class = "data.frame")

merge(s.d, feb06, all=T)
  RiverMile X2.1.06

1        61      NA
2       119      NA
3       148      NA
4       179      NA
5       185      NA
6       190      NA
7       198      NA
8       202 2850000

#this is what I want- is there a way to implement this over many data frames

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

	[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 29 Apr 2008 - 15:44:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Apr 2008 - 17:30:34 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive