[19091] in s-news-athena

home help back first fref pref prev next nref lref last post

RE: [S] Question on data manipulation

daemon@ATHENA.MIT.EDU (Abd Rahman Kassim)
Wed Sep 1 20:33:38 1999

Message-Id: <01BEF51C.FD1BCEA0.rahmank@frim.gov.my>
From: Abd Rahman Kassim <rahmank@frim.gov.my>
To: "'S-news@wubios.wustl.edu'" <S-news@wubios.wustl.edu>
Date: Thu, 2 Sep 1999 08:27:25 +0800


Dear S-Plus User,

The question was not to find X/mean.X.
But the sum of  X  for value greater than the subject X.

e.g. plot =1 x=5 relative.x=7+10+6=23, 
      plot =1 x=7 relative.x=10

Any helps would be appreciated.


Abd Rahman

-----Original Message-----
From:	Abd Rahman Kassim [SMTP:rahmank@frim.gov.my]
Sent:	Wednesday, September 01, 1999 2:31 PM
To:	'S-news@wubios.wustl.edu'
Subject:	[S] Question on data manipulation


Dear S-plus user,

Hi! I have a question on data manipulation. I have a data set as follows:

Data file name : tree.dat

     Plot     X   Mean.X    Relative.X
      1       5
      1       7
      1      10
      1       6
      2       8
      2       9
      2       2
      2       6

where,

	Mean X = mean of subject X for each plot
	Relative X = relative position of subject Xi to mean X, i.e. Xi/mean X

I calculated the mean x using the aggregate function;

     tree.ag<-aggregate(tree.dat[,c("X")],by=Plot,FUN=mean)

I merge the tree.dat with tree.ag to produce new file to produce file with 
PLOT, X and Mean.X variables.

    Mean.x<-tree.ag$x
    Plot<-tree.ag$x
    tree.ag<-data.frame(Plot,Mean.X)
    tree.mg<-merge(tree.dat,tree.ag)

But how can I calculate the relative X value?

Kindly note that the actual data set has more than 50,000 records and 
several relative value will be calculated for different main variables.

Any helps would be appreciated.


Abd Rahman
Hill Forests Silviculture
FRIM


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

home help back first fref pref prev next nref lref last post