s.d <- structure(list(RiverMile = c(202L, 198L, 190L, 185L, 179L, 148L,
119L, 61L)), .Names = "RiverMile", row.names = c(NA, -8L), class =
"data.frame")
#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
= c(NA_real_,
NA_real_, NA_real_, NA_real_, NA_real_)), .Names = c("RiverMile",
"X5.1.06"), row.names = c(29L, 30L, 31L, 32L, 34L), class = "data.frame")

merge(s.d ,c(feb06, may06), all=TRUE, by.x="RiverMile")
#I know they have different row numbers, but I can not figure out how to
fill in the ones that don't have data with NA

On Tue, Apr 29, 2008 at 8:37 AM, stephen sefick <ssefick@gmail.com> wrote:

> This is an example of two months of data from a twenty four month data set
> that I would like to apply this too.  These data are subsets of the same
> stations throught time, but differing ones were included on different
> sampling dates.  I would like to subset these data and then put them
> together as a big matrix with the by column being RiverMile.  What is the
> easiest way to proceed as this is a process that will be done on 96+
> constituents?
>
> 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 = c(NA_real_,
> NA_real_, NA_real_, NA_real_, NA_real_)), .Names = c("RiverMile",
> "X5.1.06"), row.names = c(29L, 30L, 31L, 32L, 34L), class = "data.frame")
>
> merge(feb06, may06, by="RiverMile")
>
> Error in fix.by(by.x, x) :
>   'by' must specify column(s) as numbers, names or logical
> #I have provided the column name.  Is it because they are of differing
> lengths?
>
> thanks
>
> Stephen
>
>
> --
> 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




-- 
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]]

