Skip to content
Back to formatted view

Raw Message

Message-ID: <435E8B39.1020509@gmx.de>
Date: 2005-10-25T19:44:57Z
From: Michael Graber
Subject: 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