https://github.com/cran/spacetime
Tip revision: 955e98ad2d39464cd1c36ec4f7e5c2c70fb6ed37 authored by Edzer Pebesma on 25 January 2021, 11:20:02 UTC
version 1.2-4
version 1.2-4
Tip revision: 955e98a
na.R
# na methods from zoo
time.ST = function(x, ...) index(x@time)
start.ST = function(x, ...) start(x@time)
end.ST = function(x, ..., endTime=FALSE) {
if (endTime)
max(x@endTime)
else
end(x@time)
}
na.locf.STFDF = function (object, na.rm = FALSE, ...) {
nv = dim(object)[3]
df = vector("list", nv)
names(df) = names(object@data)
for (i in 1:nv) {
x = na.locf(as(object[,,i], "xts"), na.rm = na.rm, ...)
df[[i]] = as.vector(t(x))
}
STFDF(object@sp, index(x), data.frame(df))
}
na.spline.STFDF = function(object, x = time(object),
xout, ..., na.rm = TRUE) {
nv = dim(object)[3]
df = vector("list", nv)
names(df) = names(object@data)
for (i in 1:nv) {
x = na.spline(as(object[,,i], "xts"), x, xout, na.rm = na.rm, ...)
df[[i]] = as.vector(t(x))
}
STFDF(object@sp, index(x), data.frame(df))
}
na.approx.STFDF = function(object, x = time(object),
xout, ..., na.rm = TRUE) {
nv = dim(object)[3]
df = vector("list", nv)
names(df) = names(object@data)
for (i in 1:nv) {
x = na.approx(as(object[,,i], "xts"), x, xout, na.rm = na.rm, ...)
df[[i]] = as.vector(t(x))
}
STFDF(object@sp, index(x), data.frame(df))
}