Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions R/variogramST.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ variogramST.STIDF <- function (formula, data, tlags, cutoff,
tmpInd[,1] <- ind %% nData # row number
tmpInd[,2] <- (ind %/% nData)+1 # col number
if (cores == 1){
tmpInd[,3] <- apply(tmpInd[,1:2,drop=FALSE], 1, function(x) spDists(data@sp[x[1]], data@sp[x[2]+x[1],]))
# tmpInd[,3] <- apply(tmpInd[,1:2,drop=FALSE], 1, function(x) spDists(data@sp[x[1]], data@sp[x[2]+x[1],]))
tmpInd[,3] <- spDists(data@sp[tmpInd[,1]], data@sp[tmpInd[,2]+tmpInd[,1], ], diagonal = TRUE)
} else {
if(!requireNamespace("future", quietly = TRUE) || !requireNamespace("future.apply", quietly = TRUE))
stop("For parallelization, future and future.apply packages are required")
Expand All @@ -252,7 +253,7 @@ variogramST.STIDF <- function (formula, data, tlags, cutoff,

indSp <- cbind(ind[indSp] %% nData, (ind[indSp] %/% nData)+1)
np[j,i] <- nrow(indSp) # Issue #7, Thanks to Roelof.
gamma[j,i] <- 0.5*mean((data[,,colnames(m)[1]]@data[indSp[,1],1] - data[,,colnames(m)[1]]@data[indSp[,1]+indSp[,2],1])^2,
gamma[j,i] <- 0.5*mean((data[,,colnames(m)[1]]@data[indSp[,1],1,drop=TRUE] - data[,,colnames(m)[1]]@data[indSp[,1]+indSp[,2],1,drop=TRUE])^2,
na.rm=TRUE)
}
if(progress)
Expand Down
1 change: 1 addition & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
## }

variogram <- function(object, ...) UseMethod("variogram")
units.default <- function(x, ...) base::units.difftime(x)