If I have 2 vectors of length 7 and 4 respectively (in R),
vec1 <- c(1.0, 1.0, 2.0, 3.0, 4.0, 4.0, 5.0)
vec2 <- c(1.0, 2.0, 4.0, 5.0)
I want to output a vector that shows the elements added to vec2 in order to create vec1
output <- c(1.0, 3.0, 4.0)
vec1
with index 36 to 42"? No, because-9.0
is not the 36th lements ofvec1
. Do you mean "values invec1
that are not values invec2
? No, because-9.0
appears in bothvec1
andvec2
and in your desired output. So I don't know how you define "additional elements".