I woud like to apply the following function to a vector instead of a matrix where the vector consists of >100 entries and I would like to add them starting from the third element and adding every second element.
apply(vector,1,function(x) sum(x[seq(3,length(x),2)]))
A quick example would be:
a: 123 4 100 3 594 5 302 ....
What would be added is 100+594+302+…
What about this?