Hadley Wickham's reshape package makes tasks like these pretty easy.
http://cran.r-project.org/web/packages/reshape/index.html
--
View this message in context:
http://r.789695.n4.nabble.com/simple-table-matrix-problem-tp2307969p2308713.html
Sent from the R help mailing list archive at Nabble.co
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Robin Hankin
> Sent: Friday, July 30, 2010 6:40 AM
> To: r-help@r-project.org
> Subject: [R] simple table/matrix proble
Try this:
Reduce(function(...)merge(..., by = 'ind', all = TRUE), lapply(list(x, y,
z), stack))
On Fri, Jul 30, 2010 at 10:39 AM, Robin Hankin wrote:
> Hi
>
> Given three vectors
>
> x <- c(fish=3, dogs=5, bats=2)
> y <- c(dogs=1, hogs=3)
> z <- c(bats=3, dogs=5)
>
> How do I create a multi
3 matches
Mail list logo