can you help me please how to properly use aggregate function in R? I have data like this:
SPORT FLOWS [1,] \"Other\" \"1\" [2,] \"Other\" \"1\" [3,] \
aggregate(FLOWS ~ SPORT, dat, function(x) sum(as.numeric(x)))
where dat is the name of your matrix.
dat
Here, the function is.numeric is necessary to transform the second column into numbers.
is.numeric