Dear S-Plus User,
Thanks to Dr. Renaud Lancelot, Albyn Jones and Manuela Huso for the prompt
response to my question and the suggested reference. It helps. The
suggested solution are shown below:
Dr. Renaud Lancelot
I would suggest you to take a look at S+ documentation. For example
on-line Programmer's guide (if you have S+4.5 or S+ 2000 for Win),
"Writing functions in S Plus", paragraph "Operating on subsets of data".
You will also find many details in Venables and Ripley's book, which is
one of the most valuable resource (see
http://www.stats.ox.ac.uk/pub/MASS3/) for S+.
For your specific problem, you need the subscripting operator: "[". See
on-line help for details.
Manuela Huso,
new.df<-old.df[old.df$VAR1>40,]
or
new.df<-old.df[old.df$VAR2=="A",]
Albyn Jones
attach(X)
Y <- X[VAR1>40 & VAR2=="A",] % and
Y <- X[VAR1>40 | VAR2=="A",] % or
Abd Rahman Kassim
Hill Forest Silviculture
Forest Research Institute Malaysia (FRIM)
Kepong 52109
Kuala Lumpur
-----------------------------------------------------------------------
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
|