Dear colleagues,
I have a data frame that looks so:
*x1 .... x4
1 4.2
2 3.6
3 2.7
.
.
308 n.a.
x4 is a vector of percentages, sorted in descending value. I would
like to create a new variable that represents the sum of the series of
values of x4 to that row. So I would like x5 to look like this.
x5
1 4.2
2 7.8 (4.2 +3.6)
3 10.5 (4.2+3.6+2.7)
308 =na
So the last number in the vector x5 should be 100, as these are all
percentages.
Any suggestions? Yours truly,
simon Kiss
*********************************
Simon J. Kiss, PhD
SSHRC and DAAD Post-Doctoral Fellow
John F. Kennedy Institute of North America Studies
Free University of Berlin
Lansstraße 7-9
14195 Berlin, Germany
Cell: +49 (0)1525-300-2812,
Web: http://www.jfki.fu-berlin.de/index.html
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.