[R] simplify a data frame

Tord Snall tord.snall at ebc.uu.se
Wed Feb 5 15:39:03 CET 2003


Prof Ripley and Andy Liaw,

Thanks for you quick replies! As always, I really appreciate it! 

They are exactly what I looked for, but unique() was new to me.


Tord




At 09:25 2003-02-05 -0500, you wrote:
>Is the following what you're looking for?
>
>> try.dat
>  ObjektID BalteNummer Baltessegment
>1     S.13      S.13.1      S.13.1.2
>2     S.13      S.13.1      S.13.1.3
>3     S.13      S.13.2      S.13.2.1
>4     S.13      S.13.2      S.13.2.2
>5     S.13      S.13.2      S.13.2.3
>6     S.13      S.13.3      S.13.3.6
>7     S.13      S.13.3      S.13.3.7
>8     S.13      S.13.3      S.13.3.8
>9     S.13      S.13.3      S.13.3.9
>> unique(try.dat[,-3])
>  ObjektID BalteNummer
>1     S.13      S.13.1
>3     S.13      S.13.2
>6     S.13      S.13.3
>
>
>Andy
>
>> -----Original Message-----
>> From: Tord Snall [mailto:tord.snall at ebc.uu.se]
>> Sent: Wednesday, February 05, 2003 9:08 AM
>> To: r-help at stat.math.ethz.ch
>> Subject: [R] simplify a data frame
>> 
>> 
>> Dear all,
>> For the past three hours I have tried simplify a data frame. 
>> I would be
>> really happy if someone could help solving this, I'm sure 
>> simple, problem.
>> 
>> I want to "aggregate" the data frame:
>> 
>> ObjektID	BalteNummer	Baltessegment
>> S.13	S.13.1		S.13.1.2
>> S.13	S.13.1		S.13.1.3
>> S.13	S.13.2		S.13.2.1
>> S.13	S.13.2		S.13.2.2
>> S.13	S.13.2		S.13.2.3
>> S.13	S.13.3		S.13.3.6
>> S.13	S.13.3		S.13.3.7
>> S.13	S.13.3		S.13.3.8
>> S.13	S.13.3		S.13.3.9
>> 
>> 
>> so that the results look likte this:
>> 
>> 
>> ObjektID	BalteNummer	
>> S.13	S.13.1
>> S.13	S.13.2
>> S.13	S.13.3
>> 
>> There are in fact many ObjektID.
>> 
>> 
>> Thanks in advance!
>> 
>> 
>> Sincerely
>> Tord
>> 
>> --------------------------------------------------------------
>> ---------
>> Tord Snäll
>> Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
>> Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala 
>> University
>> Villavägen 14			
>> SE-752 36 Uppsala, Sweden
>> Tel: 018-471 28 82 (int +46 18 471 28 82) (work)
>> Tel: 018-25 71 33 (int +46 18 25 71 33) (home)
>> Fax: 018-55 34 19 (int +46 18 55 34 19) (work)
>> E-mail: Tord.Snall at ebc.uu.se
>> Check this: http://www.vaxtbio.uu.se/resfold/snall.htm!
>> --------------------------------------------------------------
>> ----------
>> 
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> http://www.stat.math.ethz.ch/mailman/listinfo/r-help
>> 
>
>---------------------------------------------------------------------------
---
>Notice: This e-mail message, together with any attachments, contains
information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that
may be confidential, proprietary copyrighted and/or legally privileged, and
is intended solely for the use of the individual or entity named on this
message. If you are not the intended recipient, and have received this
message in error, please immediately return this by e-mail and then delete it.
>
>===========================================================================
===
>
>

-----------------------------------------------------------------------
Tord Snäll
Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University
Villavägen 14			
SE-752 36 Uppsala, Sweden
Tel: 018-471 28 82 (int +46 18 471 28 82) (work)
Tel: 018-25 71 33 (int +46 18 25 71 33) (home)
Fax: 018-55 34 19 (int +46 18 55 34 19) (work)
E-mail: Tord.Snall at ebc.uu.se
Check this: http://www.vaxtbio.uu.se/resfold/snall.htm!
------------------------------------------------------------------------




More information about the R-help mailing list