title: R - How exactly does resampling work with "bilinear interpolation" with different cell sizes?
body: <p>When using the <code>raster</code> package, are <code>resample</code>'s or <code>projectRaster</code>'s bilinear interpolation always taking the four nearest centroids, or does it account for differences in cell sizes?</p>
  
  <p>In the explanation for bilinear interpolation in resampling found at <a href="http://desktop.arcgis.com/en/arcmap/latest/extensions/spatial-analyst/performing-analysis/cell-size-and-resampling-in-analysis.htm" rel="nofollow noreferrer">http://desktop.arcgis.com/en/arcmap/latest/extensions/spatial-analyst/performing-analysis/cell-size-and-resampling-in-analysis.htm</a>, it says the four nearest centroids are used. In the example here, the cell sizes are similar. This explanation is not directly for the <code>raster</code> package in R, but it appeared to be the most accessible explanation for how bilinear interpolation might work in these cases.</p>
  
  <p>Are a different amount of centroids used when the cell sizes differ by more than a factor of 2 in either (or both) dimensions?</p>
  
  <p>For example, here is a raster with a higher resolution than what it is going to be resampled to:</p>
  
  <pre><code>library(raster)
  
  R1 &lt;- raster(resolution = 13, vals = sample(x = 1:5, size = 392, replace = TRUE))
  plot(R1)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/SMVqL.png" rel="nofollow noreferrer">High Resolution Raster</a></p>
  
  <p>Created here is the raster to be <code>projectRaster</code> to, and then R1 after <code>projectRaster</code> to match the new raster:</p>
  
  <pre><code>R2 &lt;- raster(resolution = 50)
  
  R3 &lt;- projectRaster(from = R1, to = R2, method = "bilinear")
  plot(R3)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ze9Ii.png" rel="nofollow noreferrer">New Low Resolution Raster</a></p>
  
  <p>Which cells from the high resolution raster are being taken into consideration when <code>projectRaster</code> is being used to create the fewer, larger cells? Since the cells in the high resolution raster are more than four times as small as the cells in the low resolution one, if bilinear interpolation just used the four closest centroids, it may not be as accurately representative as it could be if more cells were taken into consideration.</p>