[R] Fill vector filed NAs data

David Winsemius dwinsemius at comcast.net
Sun Nov 9 18:27:26 CET 2008


On Nov 4, 2008, at 8:02 AM, Luca Mortarini wrote:

> I am dealing with a 2d vector field on a
> regular grid. The field has sparse NA values
> (t near the domain borders and not isolated),
> which I am trying to substitute with
> interpolated values of the nearest point.
> What I am looking for is to replace the
> values with a weighted mean, where the
> weights are function of the distance from the
> regular values.
> I wonder if R as an implemented function for this I have looked the  
> zoo,
> the akima and the fileds packages but I have not found it.
> Thanks in advance,
>                                   Luca

I have not figured out what you mean by "substitut[ing] with
interpolated values of the nearest point". Would have seemed that  
interpolation would require at a minimum two interior points. If these  
are "not isolated" and at or near borders, it would also appear that  
extrapolation might be a more appropriate term.

Quibbles aside .... Have you looked at the locfit package? Regarding  
the vector-valued aspect of this field, perhaps you could approach it  
by analyzing the projections on single dimensions at a time.

-- 
David Winsemius
Heritage Labs



More information about the R-help mailing list