How to Replace Raster Values Less than 0 to NA in R code
<p>I am working with Landsat imagery to calculate net radiation. 
There are very low negative values (ex: -0.000003) that are in my converted reflectance raster layers. I want to make sure that my reflectances are 0 - 1 in order to reduce error in my future calculations. </p>

<p>How can I replace raster values less than 0 to "NA" in R. Similar to a raster calc function. I'm unsure how to provide an example, but I'm certain one of you could help me, yes? </p>

<p>Here is my equation for the reflectivity derived from Bastiaanssen et al. (1998)</p>

<p>Assuming, the pb1 indicates the reflectance for band 1 of Landsat, pi = 3.14..., lb1 = radiance for band 1, ESUN = exoatmospheric value for band 1, dr = the relative earth sun distance for the day of year. </p>

<pre><code>#Calculate reflectivity per band. QC: Always 0 to 1
pb1 = (pi * lb1)/(ESUN1 * cos(solzen) * dr)
</code></pre>

<p>After this raster is created, all I want to do is set the pb1 values that are less than 0 to NA. </p>

<p>Help?</p>