Dear List,
I often have to merge two or more data frames containing unique row
names but with some columns (names) common to the two data frames and
some columns not common. This toy example will explain the kind of setup
I am talking about:
mat1 <- as.data.frame(matrix(rnorm(20), nrow = 5))
mat2
Hi,
what about padding both datasets with dummy missing records ... and then
play with cbind and rbind
... like e.g.
> species5<-c(NA,NA,NA,NA)
> modmat2<-cbind(mat2,species1,species5)
and then similarly with mat1 ...
e.g.
species2<-c(NA,NA,NA,NA,NA)
> modmad1<-cbind(mat1,species2,species
On Thu, 3 Nov 2005, Gavin Simpson wrote:
> Dear List,
>
> I often have to merge two or more data frames containing unique row
> names but with some columns (names) common to the two data frames and
> some columns not common. This toy example will explain the kind of setup
> I am talking about:
>
"R-help"
Sent: Thursday, November 03, 2005 2:08 PM
Subject: [R] merging dataframes
> Dear List,
>
> I often have to merge two or more data frames containing unique row
> names but with some columns (names) common to the two data frames
> and
> some columns not common. This
The `Value' section of ?merge does say that `... in all cases the result has
no special row names', so you're left to handle that on your own. One
possibility is to use
result <- merge(mat1, mat2, all=TRUE, sort=FALSE)
so that the sorting is not done, then you can just do
rownames(result) <
On Thu, 2005-11-03 at 08:33 -0500, Liaw, Andy wrote:
> The `Value' section of ?merge does say that `... in all cases the result has
> no special row names', so you're left to handle that on your own. One
> possibility is to use
>
> result <- merge(mat1, mat2, all=TRUE, sort=FALSE)
>
> so that
Dear R-Helpers,
I have following problem:
I do have two data frames dat1 and dat2 with a commen column BNUM (long
integer). dat1 has a larger number of BNUM than dat2 and different rows
of dat2 have equal BNUM. The numbers of rows in dat1 and dat2 is not
equal. I applied the tapply-function
At 09:09 18/06/2007, Thomas Hoffmann wrote:
>Dear R-Helpers,
>
>I have following problem:
>
>I do have two data frames dat1 and dat2 with a commen column BNUM
>(long integer). dat1 has a larger number of BNUM than dat2 and
>different rows of dat2 have equal BNUM. The numbers of rows in dat1
>and
No easy to understand what exactly you mean, but try
?merge
?cbind
?rbind
Petr
Thomas Hoffmann napsal(a):
> Dear R-Helpers,
>
> I have following problem:
>
> I do have two data frames dat1 and dat2 with a commen column BNUM (long
> integer). dat1 has a larger number of BNUM than dat2 and diffe