And yet another way.
library(reshape2)
names(Dat1) <- c("big","small","nums")
dcast(Dat1 , big ~ small, sum)
John Kane
Kingston ON Canada
> -Original Message-
> From: bogaso.christo...@gmail.com
> Sent: Tue, 18 Dec 2012 20:06:42 +0530
> To: r-help@r-project.org
> Subject: [R] Summariz
Hi,
You could also use ?xtabs()
dat1<-structure(list(Col1 = structure(c(1L, 3L, 2L, 1L, 3L, 3L, 1L), .Label =
c("A",
"B", "C"), class = "factor"), Col2 = structure(c(2L, 2L, 1L,
1L, 2L, 1L, 2L), .Label = c("a", "b"), class = "factor"), Col3 = c(1,
2, 3, 4, 5, 6, 2)), .Names = c("Col1", "Col2
Hi Christofer,
Check ?tapply, ?aggregate and ?ave. Here is a way of doing in using the
first function:
tapply(Dat1[, 3], list(Dat1[,1], Dat1[,2]), sum, na.rm = TRUE)
HTH,
Jorge.-
On Wed, Dec 19, 2012 at 1:36 AM, Christofer Bogaso <> wrote:
> Dat1 <- structure(list(factor.sample.LETTERS.1.3..
3 matches
Mail list logo