[R-sig-Geo] [FORGED] Re: Error when I try to interpolate NA for each cell from Rasterstack
Vijay Lulla
vijaylulla at gmail.com
Sat Jan 14 20:57:31 CET 2017
Thank you for pointing out my bad practice. Even `?c` mentions that
as.vector is more intuitive and a safer approach. I was unaware of the
side-effect nature of `c`! Enlightening.
Appreciatively,
Vijay.
On Sat, Jan 14, 2017 at 2:47 PM, Rolf Turner <r.turner at auckland.ac.nz>
wrote:
> On 15/01/17 05:11, Vijay Lulla wrote:
>
>> I think this is because interpNA returns a matrix of one column whereas
>> raster::setValues (used internally by calc) expects the values to be a
>> vector of elements. Changing the last line in `fun_interp` from
>> `return(z)` to `return(c(z))` might do the trick.
>>
>
> <SNIP>
>
> Better to use return(as.vector(z)). See fortune(185).
>
> cheers,
>
> Rolf Turner
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list