I want to sum all elements of vectors together. However, I am trying to exclude the last element of each vector. For example,
vector1 <- c(10,20,3000)
vector2 <- c(20,40,5000)
sum(vector1, vector2)
[1] 8090
But I would like to exclude the 3000
in vector1
and the 5000
in vector2
to output [1] 90
. Also, this is just a reproducible example, my real vectors don't have the same consistent number of elements. Could this be done?