[R-sig-Geo] Error with STFDF
Supadog
zdziarze at scss.tcd.ie
Mon Aug 26 20:11:45 CEST 2013
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.
More information about the R-sig-Geo
mailing list