n
is used).
NOTE: beginCluster may fail when the package 'nws' is installed. You can fix that by removing the 'nws' package, or by setting the cluster type manually, e.g. beginCluster(type="SOCK")
endCluster closes the cluster and removes the object.
The use of the cluster by functions is automatic, but has only been implemented in a few functions.beginCluster(n, type, nice)
endCluster()
projectRaster, resample, distance, extract (when using polygons)
.
If you want to write your own cluster-enabled functions see getCluster, returnCluster, and the vignette about writing functions
beginCluster()
# beginCluster(type="SOCK")
r <- raster(ncol=36, nrow=18)
r[] <- NA
r[500] <- 1
dist <- distance(r)
endCluster()
Run the code above in your browser using DataLab