<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 11, 2015 at 5:38 PM, Roger Bivand <span dir="ltr"><<a href="mailto:Roger.Bivand@nhh.no" target="_blank">Roger.Bivand@nhh.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On Thu, 11 Jun 2015, Anna Petrášová wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hi,<br>
<br>
I am using R rgrass7 package and it seems that when writing a raster which<br>
has only NA, it fails with "only numeric values may be exported":<br>
<br>
<a href="https://github.com/cran/rgrass7/blob/386b11e5a2f3879ec63d299c0594f55cbd39c8e5/R/bin_link.R#L446" target="_blank">https://github.com/cran/rgrass7/blob/386b11e5a2f3879ec63d299c0594f55cbd39c8e5/R/bin_link.R#L446</a><br>
</blockquote>
<br></span>
This site has nothing whatsoever to do with anything, and is certainly unauthorised. Please only refer to R-Forge:<br>
<br>
<a href="https://r-forge.r-project.org/scm/viewvc.php/pkg/rgrass7/R/bin_link.R?view=markup&revision=25&root=spgrass" target="_blank">https://r-forge.r-project.org/scm/viewvc.php/pkg/rgrass7/R/bin_link.R?view=markup&revision=25&root=spgrass</a><br>
<br>
shows the full context, file name, but not line number.<br>
<br>
Are your NAs numeric?<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
is.numeric(NA)<br>
</blockquote>
[1] FALSE<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
is.numeric(as.numeric(NA))<br>
</blockquote>
[1] TRUE<span class=""><br></span></blockquote><div> </div><div>The problem seems to be in line of my code:</div><div><br></div><div>I_oaks_rast_sp <- as(I_oaks_rast, 'SpatialGridDataFrame') </div><div><br></div><div>where I_oaks_rast is numeric but not the resulting I_oaks_rast_sp which is then written with writeRAST and fails. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Is this intended behavior or a bug?<br>
</blockquote>
<br></span>
User misunderstanding. NAs are logical unless created in the context of an object with a different storage mode.<br></blockquote><div><br></div><div> Indeed, I'm not an experienced R user...</div><div><br></div><div>Thank you</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Thank you,<br>
<br>
Anna<br>
<br><span class=""><font color="#888888">
</font></span></blockquote><span class=""><font color="#888888">
<br>
-- <br>
Roger Bivand<br>
Department of Economics, Norwegian School of Economics,<br>
Helleveien 30, N-5045 Bergen, Norway.<br>
voice: <a href="tel:%2B47%2055%2095%2093%2055" value="+4755959355" target="_blank">+47 55 95 93 55</a>; fax <a href="tel:%2B47%2055%2095%2091%2000" value="+4755959100" target="_blank">+47 55 95 91 00</a><br>
e-mail: <a href="mailto:Roger.Bivand@nhh.no" target="_blank">Roger.Bivand@nhh.no</a></font></span></blockquote></div><br></div></div>