From: "Overstreet, Jason (FL51)" <Jason.Overstreet@honeywell.com>
To: s-news@lists.biostat.wustl.edu
Subject: [S] Calculation done on rows for select columns
Date: Mon, 23 Jan 2006 10:56:18 -0700
I have a data frame as shown below called xy:
> xy
x.1 x.2 x.3 y.1 y.2 y.3
1 1 5 9 2 10 18
2 2 6 10 4 12 20
3 3 7 11 6 14 22
4 4 8 12 8 16 24
>
I was wondering what would be an easy way to have the mean and variance
calculated and stored as follows:
> xy
x.1 x.2 x.3 mean.x var.x y.1 y.2 y.3
mean.y var.y
1 1 5 9 5 16 2 10 18
10 64
2 2 6 10 6 16 4 12 20
12 64
3 3 7 11 7 16 6 14 22
14 64
4 4 8 12 8 16 8 16 24
16 64
>
Jason Overstreet
Statistician
Honeywell DSES
(727) 539-3964