It's nearly a year old but thought I'd throw in another option.
approxNA function from the
raster package works if you have several
Raster objects in a
RasterStack, rather than an individual raster. The reason is that it will use the information in the other raster layers to interpolate what an NA might be, so it works well for raster data that changes across time, and if the time between raster layers is very short (i.e. hours, a few days, a week), such as Chlorophyll concentration or sea surface temperature (which is what I use and why it worked for me). This does imply that coarse temporal resolution between raster layers would lead to less accurate interpolations of missing data. If you've got several soil layers of the same place with very fine temporal resolution (hours/days/weeks), it could work. You would only need to specify the
RasterStack object, as the default method is set to
linear (the other option is
constant), while the default options for all the other arguments seem to work pretty well, too.
If you don't have several layers, you could try to using the
focal function, also from the
raster package. It uses a combination of a moving window to look at neighboring cells and a matrix of weights to interpolate missing data. Full Disclaimer: I have not used this before and not sure how it work (or how fast it'll process).
Update: Added a small note about considering temporal resolution when using the