[R] Assigning values based on a separate reference (lookup) table

Steve Murray smurray444 at hotmail.com
Fri Aug 14 21:05:10 CEST 2009


Thanks to you both for your responses.
3
I think these approaches will *nearly* do the trick, however, the problem is that the reference/lookup table is based on 'bins' of latitude values, eg.>61, 60-56, 55-51, 50-46 etc. whereas the actual data (in my 720 x 360 data frame) are not binned, e.g. 89.75, 89.25, 88.75, 88.25, 87.75 etc. - instead they 'increment' by -0.5 each time, and therefore many of the 367200 values which are in the data frame will have latitude values falling into the same 'reference' bin.

It's for this reason that I think the 'merge' approach might fall down, unless there's a way of telling 'merge' that latitude can still be considered to match if they fall within a range. For example, if my 720 x 360 data frame has values whose corresponding latitude (row name) values are, say, 56.3, 55.9, 58.2, 56.8 and 57.3, then the original value in the grid needs to be assigned a 'p' value which corresponds with what is read off of the reference table from the bin 56-60.

Hope this makes sense! If not, please feel free to ask for clarification.

Many thanks again,

Steve


_________________________________________________________________

oticons.




More information about the R-help mailing list