QGIS/python/plugins/processing/r/scripts/Relative_distribution_(raster_covariate).rsx
Victor Olaya 7165e882cd [processing] R improvements
This commit:

Deletes Example scripts

Replaces Example scripts with more up to date versions

Adds general categories for r scripts: Basic statistics, Vector processing, Raster processing and Point pattern analysis

adds help files to all r scripts

Adds a groups of r scripts entitled Home range analysis, that includes Kernel href, LSCV Kernel, Minimum convex polygon, single linkage cluster analysis and characteristic hull method, using adehabitatHR()

Adds the following R scripts contributed by Yury Ryabov ( riabovvv(at)gmail.com ): Advanced raster histogram, Monte carlo spatial randomness, Relative distribution (distance covariate), Relative distribution (raster covariate),
2013-11-11 22:45:06 +01:00

30 lines
726 B
R

##Point pattern analysis=group
##points=vector
##covariate=raster
##covariate_name=string mandatory_covariate_name_(no_spaces)
##x_label=string
##plot_name=string
##legend_position=string float
##showplots
library(geostatsp)
library(maptools)
library(rpanel)
if (covariate_name == "") {
rp.messagebox('"covariate name" must not be empty!', title = 'oops!')
}
else {
S <- points
SP <- as(S, "SpatialPoints")
P <- as(SP, "ppp")
covariate <- raster(covariate, layer = 1)
covariate <- as.im(covariate)
library(spatstat)
S <- points
SP <- as(S, "SpatialPoints")
P <- as(SP, "ppp")
plot(rhohat(P, covariate, covname=covariate_name), xlab= x_label,
legendpos = legend_position,
legendargs=list(bg="transparent"),
main = plot_name)
}