I am using R and the spacetime package.

I am having problems using STFDF.

I want to use the STF data-structure since I have spacetime data with recurrent observations for fixed spatial coordinates. The problem is that there are some missing values here and there (both space and time wise). What should I do to fill the gaps? Can I put NAs in it?

The data is composed by daily ozone mean measures for each station during a period of 1 year (2016, Jan to Dec). The stations are 30, however most of them don't have 366 records. Here is the distribution of stations by number of yearly measures:

enter image description here

How should I handle this? Do I need to add the records putting NAs / interpolating them? Can spacetime work around the NAs or automatically interpolate them?

  • $\begingroup$ Kriging already does the interpolation. It is unclear what the problem is. I don't know STFDF but, did you try reading the manual and try putting NA in place of the empty spots? $\endgroup$ Jan 21, 2020 at 7:15

1 Answer 1


According to the title of the question, the data is to be processed by kriging.

Kriging does not require, in general, that the observations should be taken on a grid.

So, unless the particular software that you are using insists on having observations on a grid, you should simply do nothing and use your dataset as it is.

  • $\begingroup$ I was not clear, sorry. I am using the spacetime package with R. In order to do the kriging it seems like you must put the data in some sort of structure (at least, that's what happens in all spacetime tutorials I have found) $\endgroup$
    – Pigna
    Mar 5, 2018 at 19:56
  • 2
    $\begingroup$ @Pigna : then please edit your question to clarify that you are asking about this particular package. If possible, specify also which function(s) in the package you have been trying to use, and why you have failed. $\endgroup$ Mar 5, 2018 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.