[R-sig-Geo] spacetime: remove NAs from STSDF object

Christian Kamenik christian.kamenik at giub.unibe.ch
Mon Aug 22 17:49:40 CEST 2011


Dear all,

I have observations in space and time with quite a lot of missing values 
that I want to arrange in a space-time sparse data-frame object (STSDF 
from package 'spacetime'). For simplicity, I first created a 
spatio-temporal full grid data frame (which I call my.STFDF) that 
included all the missing observations. Then I did the following:

my.STSDF <- as(my.STFDF, "STSDF")
slot(my.STSDF,'index') <- 
matrix(slot(my.STSDF,'index')[complete.cases(slot(my.STSDF,'data'))],ncol=2)
slot(my.STSDF,'data') <- 
slot(my.STSDF,'data')[complete.cases(slot(my.STSDF,'data')),]

This is the first time I try the spacetime package, and I was wondering 
if the code above would be an appropriate way of dealing with STFDF and 
STSDF objects.

Many thanks in advance, Christian

-

-----------------------------------------------
Oeschger Centre for Climate Change Research, Institute of Geography&  Institute of Plant Sciences
University of Bern

http://www.stomatocysts.unibe.ch/kamenik
mailto: christian.kamenik at giub.unibe.ch

Postal address:
Dr. Christian Kamenik
Institute of Geography
Erlachstrasse 9a, Trakt 3
3012 Bern, Switzerland

Tel. +41 (0)31 631 5091
Fax +41 (0)31 631 43 38



More information about the R-sig-Geo mailing list