On Mon, Jan 17, 2011 at 10:37:42PM +, Monica Pisica wrote:
>
> Hi,
>
> I've got 2 very good solutions, thank you very much. One, from Henrique
> Dallazuanna using the library reshape and one line of code - although it will
> take me quite some time to understand it. Here it is what he sent:
To: pisican...@hotmail.com
> CC: r-help@r-project.org
> Subject: Re: [R] matrix manipulations
>
> Monica -
> Perhaps this small example can demonstrate how factors can
> solve your problem:
>
> > d1 =
> > data.frame(cat=sample(c('cat2','c
Try this:
library(reshape)
xtabs(rowSums(cbind(value.x, value.y), na.rm = TRUE) ~ X1 + X2,
merge(melt(m1), melt(m2), by = c('X1', 'X2'), all = TRUE), exclude = FALSE)
On Mon, Jan 17, 2011 at 5:59 PM, Monica Pisica wrote:
>
> Hi,
>
> I am having some difficulties with matrix operations. It is a
Monica -
Perhaps this small example can demonstrate how factors can
solve your problem:
d1 =
data.frame(cat=sample(c('cat2','cat5','cat6'),100,replace=TRUE),group=sample(c('land','water'),100,replace=TRUE))
d2 =
data.frame(cat=sample(c('cat1','cat3','cat4'),100,replace=TRUE),group=sample(c(
Hi,
I am having some difficulties with matrix operations. It is a little hard to
explain it so please bear with me. I have a very large data set, large enough
that it needs to be split in parts in order to deal with. I can work things on
these "parts" but the problem lies in adding together th
5 matches
Mail list logo