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
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
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
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
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
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
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
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
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
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
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
11 matches
Mail list logo