R newbie here. I have a csv sheet which i have sorted my data according to gender (Child's sex). I want to add/sum the column up to a certain point only, in this case I want to sum the Child's age column from column 301 to 311 then store the value, and then 312 to 336. how do i do this in r. Thanks
Asked
Active
Viewed 1,104 times
-1
-
read about `aggregate` – Sotos Dec 19 '16 at 07:28
1 Answers
0
You could library(data.table)
:
data <- as.data.table( read.csv(file.choose(), header = T) )
data[,.(age_sum = sum(age)), by=list(child_sex) ]

Mario
- 2,393
- 2
- 17
- 37