Re: [R] data.frame-question

From: bogdan romocea <br44114_at_gmail.com>
Date: Wed 26 Oct 2005 - 05:59:48 EST


Welcome to R. See

   ?merge
then

   ?aggregate
or

   require(Hmisc)
   ?summarize
or

   ?by
You can probably find many examples in the archives, if needed.

> -----Original Message-----
> From: Michael Graber [mailto:michael_graber@gmx.de]
> Sent: Tuesday, October 25, 2005 3:45 PM
> To: R-Mailingliste
> Subject: [R] data.frame-question
>
>
> Dear R-List,
> I am very new to R and programming itself, so my question may
> be easy to
> answer for you.
> I tried a lot and read through the manuals, but I still have the
> following problem:
> I have 2 data-frames:
> Number<-as.numeric (Number)
> Name<-as.character (Name)
> TAB1<-data.frame (Name,Number)
> - it looks like this:-
> Name Number
> A 2
> A 3
> A 6
> B 8
> B 12
> B 7
> C 8
> D 90
> E 12
> E 45
>
> Name_singular<-as.character (Name_singular)
> TAB2<-data.frame (Name_singular)
> # it looks like this:

> Name_singular
> A
> B
> C
> D
> E
> -My result should be a data-frame, where the first column is
> Name_singular and the second column should be the sum of the numbers
> where Name ==Name_singular.-
> For example:
> TAB3:
> Name_singular Sum
> A 11
> B 27
>
> - I tried it with for-loops, but I think there must be an easier way.-
> I would be very grateful for your help,
>
>
> Michael Graber
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Oct 26 06:05:37 2005

This archive was generated by hypermail 2.1.8 : Wed 26 Oct 2005 - 09:15:22 EST