Basically, I want to take elements in vector k, but not in vector l, and append them to vector h. Here is my code using for loop:
k=c(1,2,3,5,8,9)
l=c(3,5,7,5,7,9,64)
h=c()
for (i in k) {
if (!(i %in% l)) {
print(i)
append(h,i)
}
}
After run the code, vector h does not change at all, but it should be c(1,2,8).