Hello,
I'm having trouble creating an STFDF object from my spacio-temporal data.
The object is intended to be used later to perform kriging interpolation.
My data looks like this (a few lines):
x y t value
1 30 30 497826 6.6
2 960 30 499430 7.4
3 1890 30 500990 59.8
And I type in the following commands:
# read in the data from csv file and specify coordinates columns
f <- read.csv('data.csv')
coordinates(f) <- ~x+y
# create SP object out of the coordinates
g <- as(f, "SpatialPoints")
# obtain time points. The timestamps are in milliseconds.
ts = f$t
options("digits.secs"=3)
time = as.POSIXct(ts/1e3, origin="1970-01-01", tz="Europe/Dublin")
# create data.frame
data = as.data.frame(f[2])
# finally create the STFDF object
obj = STFDF(g, time, data)
But I get the following error message:
Error: nrow(object at data) == length(object at sp) * nrow(object at time) is not
TRUE
What am I missing? The data is in long form so each time reading has its own
coords and data value and I don't want the equation in the error to hold.
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Error-with-STFDF-tp7584461.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
Error with STFDF
4 messages · Philippi, Tom, Supadog, Benedikt Gräler
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20130826/f3a88762/attachment.pl>
Hi Tom, Thanks for the response. I would like to interpolate for values in the 'value' column given different x, y and t values. I was hoping to use the krigeST function but I just did a little bit of searching and it appears as though it won't work with anything other than STFDF objects. Do I have any other options? Thanks, Ziggy -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Error-with-STFDF-tp7584461p7584468.html Sent from the R-sig-geo mailing list archive at Nabble.com.
Dear Ziggy,
the spatio-temporal sum-metric variogram model is the only one that is
currently also implemented for the STSDF classes. You should be able
to coerce your STIDF to a STSDF using as(). In the STSDF case ("S"
meaning sparse), the space and time instances are stored once and an
index relates observations to their spatio-temporal location. It can
handle both extreme cases of a full layout (ST-F-DF) and the irregular
case (ST-I-DF). See Figure 1 in the spacetime vignette [1] for a
graphical representation of all four ST* layouts.
Best,
Ben
[1] http://cran.r-project.org/web/packages/spacetime/vignettes/jss816.pdf
On 27.08.2013 01:03, Supadog wrote:
Hi Tom, Thanks for the response. I would like to interpolate for values in the 'value' column given different x, y and t values. I was hoping to use the krigeST function but I just did a little bit of searching and it appears as though it won't work with anything other than STFDF objects. Do I have any other options? Thanks, Ziggy -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Error-with-STFDF-tp7584461p7584468.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Benedikt Gr?ler ifgi - Institute for Geoinformatics University of Muenster http://ifgi.uni-muenster.de/graeler Phone: +49 251 83-33082 Mail: ben.graeler at uni-muenster.de