[R] Aggregate or extract function ?

Celine bellard.celine at gmail.com
Mon Nov 7 21:50:55 CET 2011


Hi R user,

I have two dataframe with different variables and coordinates :
       X         Y sp bio3 bio5 bio6 bio13 bio14
1 -70.91667 -45.08333  0   47  194  -27    47    12
2 -86.58333  66.25000  0   16  119 -345    42     3
3 -62.58333 -17.91667  0   68  334  152   144    28
4 -68.91667 -31.25000  0   54  235  -45    25     7
5  55.58333  48.41667  0   23  319 -172    23    14
6  66.25000  37.75000  0   34  363  -18    49     0

and this one :

 X  Y LU1 LU2 LU3 LU4 LU5 LU6 LU7 LU8 LU9 LU10 LU11 LU12 LU13       LU14
LU15 LU16 LU17 LU18
1 -36.5 84   0   0   0   0   0   0   0   0   0    0    0    0    0  
0.000000    0    0    0    0
2 -36.0 84   0   0   0   0   0   0   0   0   0    0    0    0    0  
0.000000    0    0    0    0
3 -35.5 84   0   0   0   0   0   0   0   0   0    0    0    0    0 
26.085468    0    0    0    0
4 -35.0 84   0   0   0   0   0   0   0   0   0    0    0    0    0  
0.000000    0    0    0    0
5 -34.5 84   0   0   0   0   0   0   0   0   0    0    0    0    0  
5.267761    0    0    0    0
6 -34.0 84   0   0   0   0   0   0   0   0   0    0    0    0    0
105.371069    0    0    0    0

I wouldlike to add to my first dataframe the value of the LU variables at
the coordinates of the first dataframe. Of course, the coordinates are not
at the same resolution and are different, this is the problem.
 I wouldlike to decrease the resolution of the first one because the second
dataframe have a coarser resolution and obtain something like that :

       X         Y sp bio3 bio5 bio6 bio13 bio14 LU1 LU2 LU3 LU4 ...
1 -70.91667 -45.08333  0   47  194  -27    47    12 0 22.08 76.9
2 -86.58333  66.25000  0   16  119 -345    42     3 0 22.08 76.9
3 -62.58333 -17.91667  0   68  334  152   144    28 0 22.08 76.9
4 -68.91667 -31.25000  0   54  235  -45    25     7 0 22.08 76.9
5  55.58333  48.41667  0   23  319 -172    23    14 0 22.08 76.9
6  66.25000  37.75000  0   34  363  -18    49     0 0 22.08 76.9

Do someone know a function or a way to do obtain that ?

Thanks in advance for the help,
Céline


--
View this message in context: http://r.789695.n4.nabble.com/Aggregate-or-extract-function-tp4013673p4013673.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list