Given are the two data frames A and B, where A is longer than B. The values in the lines of A must be present in lines of B. And if a line of A does not exist in B, it should be deleted. At the end A should have the same lines like B. Do I Need a for-loop? Thanks for your help, I hope I illustrated the problem well.
for example:
x=c(1,3,7,1,1,4,3)
y=c(2,5,5,6,2,6,4)
A<-cbind.data.frame(x,y)
x2<-c(1,3,5,1,3)
y2<-c(2,4,7,6,8)
B<-cbind.data.frame(x2,y2)
##A should like this at the end
```
x<-c(1,1,1,3)
y<-c(2,6,2,4)
A<-c(x,y)
```