Re: [R] Tabulation

2009-10-10 Thread Charles C. Berry
On Sat, 10 Oct 2009, Dieter Menne wrote: Ashta wrote: I have a data set x1 x2 x3 1 2 1 1 2 3 2 1 2 1 2 1 3 1 1 I want to tabulate in the following way. 1 2 3 x13 2 1 x22 3 0 x33 1 1 It is just like frequency distribution

Re: [R] Tabulation

2009-10-10 Thread Gabor Grothendieck
Here are a couple of possibilities both based on first converting the data frame to long form: > xtabs(~ind + values, stack(DF)) values ind 1 2 3 x1 3 1 1 x2 2 3 0 x3 3 1 1 > t(table(stack(DF))) values ind 1 2 3 x1 3 1 1 x2 2 3 0 x3 3 1 1 On Sat, Oct 10, 2009 at 10:43 AM, A

Re: [R] Tabulation

2009-10-10 Thread Dieter Menne
Ashta wrote: > > > I have a data set > x1 x2 x3 > 1 2 1 > 1 2 3 > 2 1 2 > 1 2 1 > 3 1 1 > > I want to tabulate in the following way. > 1 2 3 > x13 2 1 > x22 3 0 > x33 1 1 > > It is just like frequency distribution > See func

[R] Tabulation

2009-10-10 Thread Ashta
Hi all, I have a data set x1 x2 x3 1 2 1 1 2 3 2 1 2 1 2 1 3 1 1 I want to tabulate in the following way. 1 2 3 x13 2 1 x22 3 0 x33 1 1 It is just like frequency distribution Any help is highly appreciated [[alternative

Re: [R] Tabulation of aggregated data.frame

2008-05-09 Thread Henrique Dallazuanna
Try: xtabs(x ~ Group.2 + Group.1, data=x) On Fri, May 9, 2008 at 1:25 PM, Oh Dong-hyun <[EMAIL PROTECTED]> wrote: > Hi useRs! > > I would like to know how to make aggregated data.frame with aggregate() > tabulated. > > For example, I run the following command to aggregate re with respect to > gr

Re: [R] Tabulation of aggregated data.frame

2008-05-09 Thread Jorge Ivan Velez
Hi there, Try this: R> tapply(aggr$x,aggr[,c(2,1)],function(x) x) Group.1 Group.219921993199419951996199719981999 2000 15 0.16392 0.15467 0.15456 0.15391 0.16511 0.17368 0.17955 0.19805 0.20546 16 0.16237 0.18359 0.13811 0.13988

[R] Tabulation of aggregated data.frame

2008-05-09 Thread Oh Dong-hyun
Hi useRs! I would like to know how to make aggregated data.frame with aggregate() tabulated. For example, I run the following command to aggregate re with respect to group1 and group2. > (aggr <- with(final, aggregate(re, group1, group2, mean))) Group.1 Group.2 x 1 1992

Re: [R] tabulation on dataframe question

2008-02-18 Thread Moshe Olshansky
If d is your dataframe, how about ind <- d$Dist == 2 aggregate(d,by=list(d$NameA,dNameA),FUN=length) Regards, Moshe. --- Karin Lagesen <[EMAIL PROTECTED]> wrote: > > I have a data frame with data similar to this: > > NameA GrpA NameB GrpB Dist > A Alpha B Alpha 0.2 > A

Re: [R] tabulation on dataframe question

2008-02-18 Thread Henrique Dallazuanna
Try this: with(x, {tmp <- table(x[Dist==0.2,c('GrpA', 'GrpB')]) tmp[lower.tri(tmp)] <- tmp[upper.tri(tmp)] tmp}) On 18/02/2008, Karin Lagesen <[EMAIL PROTECTED]> wrote: > > I have a data frame with data similar to this: > > NameA GrpA NameB GrpB Dist > A Alpha B Alpha

Re: [R] tabulation on dataframe question

2008-02-18 Thread Gabor Grothendieck
Try this: # read test data Lines <- "NameA GrpA NameB GrpB Dist A Alpha B Alpha 0.2 A Alpha C Beta0.2 A Alpha D Beta0.4 B Alpha C Beta0.2 B Alpha D Beta0.1 C Beta D Beta0.3 " DF <- read.ta

[R] tabulation on dataframe question

2008-02-18 Thread Karin Lagesen
I have a data frame with data similar to this: NameA GrpA NameB GrpB Dist A Alpha B Alpha 0.2 A Alpha C Beta0.2 A Alpha D Beta0.4 B Alpha C Beta0.2 B Alpha D Beta0.1 C Beta D Beta0.3 Dis