Suppose I have a file A
with (id,x,y)
and another file B
with (ID, xmin, xmax,ymin,ymax)
, with dim(A)~50000
and dim(B)~3000
.
What I need is to add an additional column to A where each row is a vector composed of all the B$ID[j]
for which A$x[i]
is between B$xmin[j]
and B$xmax[j]
and, simultaneously, A$y[i]
is between B$ymin[j]
and B$ymax[j]
.
This vector will have a min dimension of 1 and a max dimension of 4.
(essentially I have a grid and I want to know in which cells of the grid the elements of A are falling. They will always fall in at least one cell to a maximum of 4)
How can I express it ?
Thanks for your help