Skip to content
Permalink
Browse files

[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),
  • Loading branch information
volaya committed Nov 11, 2013
1 parent 371f9ba commit 7165e882cd3d25df70c41d4c725cb261276d1e12
Showing with 752 additions and 90 deletions.
  1. +0 −8 python/plugins/processing/r/scripts/Advanced_Raster_histogram.rsx
  2. +22 −0 python/plugins/processing/r/scripts/Advanced_raster_histogram.rsx.help
  3. +8 −0 python/plugins/processing/r/scripts/Characteristic_hull_method.rsx
  4. +26 −0 python/plugins/processing/r/scripts/Characteristic_hull_method.rsx.help
  5. +0 −9 python/plugins/processing/r/scripts/Compute_Ripley-Rasson_spatial_domain.rsx
  6. +0 −6 python/plugins/processing/r/scripts/Create_random_sampling_grid.rsx
  7. +0 −6 python/plugins/processing/r/scripts/Create_regular_sampling_grid.rsx
  8. +4 −0 python/plugins/processing/r/scripts/Dotplot.rsx
  9. +22 −0 python/plugins/processing/r/scripts/Dotplot.rsx.help
  10. +8 −0 python/plugins/processing/r/scripts/F_function.rsx
  11. +26 −0 python/plugins/processing/r/scripts/F_function.rsx.help
  12. +0 −7 python/plugins/processing/r/scripts/F_function_-_distance_from_a_point_to_nearest_event.rsx
  13. +0 −5 python/plugins/processing/r/scripts/Field_dotplot.rsx
  14. +0 −5 python/plugins/processing/r/scripts/Field_histogram.rsx
  15. +0 −14 python/plugins/processing/r/scripts/Field_summary_statistics.rsx
  16. +0 −4 python/plugins/processing/r/scripts/Field_table_of_counts.rsx
  17. +4 −0 python/plugins/processing/r/scripts/Frequency_table.rsx
  18. +26 −0 python/plugins/processing/r/scripts/Frequency_table.rsx.help
  19. +8 −0 python/plugins/processing/r/scripts/G_function.rsx
  20. +26 −0 python/plugins/processing/r/scripts/G_function.rsx.help
  21. +0 −7 python/plugins/processing/r/scripts/G_function_-_distance_to_nearest_event.rsx
  22. +5 −0 python/plugins/processing/r/scripts/Histogram.rsx
  23. +14 −0 python/plugins/processing/r/scripts/Histogram.rsx.help
  24. +0 −7 python/plugins/processing/r/scripts/K_function_-_Ripley_K.rsx
  25. +15 −0 python/plugins/processing/r/scripts/Kernel_h_ref.rsx
  26. +38 −0 python/plugins/processing/r/scripts/Kernel_h_ref.rsx.help
  27. +0 −5 python/plugins/processing/r/scripts/Kolmogorov-Smirnov_normality_test.rsx
  28. +5 −0 python/plugins/processing/r/scripts/Kolmogrov-Smirnov_test.rsx
  29. +20 −0 python/plugins/processing/r/scripts/Kolmogrov-Smirnov_test.rsx.help
  30. +7 −0 python/plugins/processing/r/scripts/Minimum_convex_polygon.rsx
  31. +36 −0 python/plugins/processing/r/scripts/Minimum_convex_polygon.rsx.help
  32. +12 −0 python/plugins/processing/r/scripts/Monte-Carlo_spatial_randomness.rsx
  33. +34 −0 python/plugins/processing/r/scripts/Monte-Carlo_spatial_randomness.rsx.help
  34. +4 −4 python/plugins/processing/r/scripts/Quadrat_analysis.rsx
  35. +26 −0 python/plugins/processing/r/scripts/Quadrat_analysis.rsx.help
  36. +6 −0 python/plugins/processing/r/scripts/Random_sampling_grid.rsx
  37. +26 −0 python/plugins/processing/r/scripts/Random_sampling_grid.rsx.help
  38. +3 −3 python/plugins/processing/r/scripts/Raster_histogram.rsx
  39. +22 −0 python/plugins/processing/r/scripts/Raster_histogram.rsx.help
  40. +6 −0 python/plugins/processing/r/scripts/Regular_sampling_grid.rsx
  41. +18 −0 python/plugins/processing/r/scripts/Regular_sampling_grid.rsx.help
  42. +42 −0 python/plugins/processing/r/scripts/Relative_distribution_(distance_covariate).rsx
  43. +42 −0 python/plugins/processing/r/scripts/Relative_distribution_(distance_covariate).rsx.help
  44. +29 −0 python/plugins/processing/r/scripts/Relative_distribution_(raster_covariate).rsx
  45. +42 −0 python/plugins/processing/r/scripts/Relative_distribution_(raster_covariate).rsx.help
  46. +12 −0 python/plugins/processing/r/scripts/Ripley_-_Rasson_spatial_domain.rsx
  47. +22 −0 python/plugins/processing/r/scripts/Ripley_-_Rasson_spatial_domain.rsx.help
  48. +12 −0 python/plugins/processing/r/scripts/Single-linkage_cluster_analysis.rsx
  49. +34 −0 python/plugins/processing/r/scripts/Single-linkage_cluster_analysis.rsx.help
  50. +14 −0 python/plugins/processing/r/scripts/Summary_statistics.rsx
  51. +26 −0 python/plugins/processing/r/scripts/Summary_statistics.rsx.help

This file was deleted.

@@ -0,0 +1,22 @@
(dp0
S'ALG_CREATOR'
p1
V
p2
sS'ALG_DESC'
p3
VThis algorithm generates a histogram or a density plot for the given raster. NOTE that you should not use this algorithm to process large rasters.\u000a\u000aR dependencies: rpanel, rasterVis. If you are using Linux you need to install "tcktk" and "BWidget" from your package master.
p4
sS'Dens_or_Hist'
p5
VUse 'hist' to produce histogram of the raster values (separate plots for each band) and 'dens' if you want to create a density plot (single plot for all bands).
p6
sS'RPLOTS'
p7
VRaster histogram.
p8
sS'Layer'
p9
VA single- or multi-band raster.
p10
s.
@@ -0,0 +1,8 @@
##Home Range Analysis=group
##Layer=vector
##Field=Field Layer
##Home_ranges=Output vector
library(adehabitatHR)
library(deldir)
res <- CharHull(Layer[,Field])
Home_ranges<-getverticeshr(res)
@@ -0,0 +1,26 @@
(dp0
S'ALG_DESC'
p1
VThis script computes the Characteristic Hull method that relies on the calculation of the Delaunay triangulation of the set of relocations. Then, the triangles are ordered according to their area (and not their perimeter). The smallest triangles correspond to the areas the most intensively used by the animals. It is then possible to derive the home range estimated for a given percentage level.\u000a\u000aR depencies: library "adehabitatHR" and "deldir".\u000a
p2
sS'Home_ranges'
p3
VThe home-range contours.
p4
sS'ALG_CREATOR'
p5
VFilipe S. Dias, filipesdias(at)gmail.com
p6
sS'Layer'
p7
VA layer containing the relocations of one or more animals
p8
sS'Field'
p9
VThe field containing the unique indentifer for each animal (type "string").
p10
sS'ALG_HELP_CREATOR'
p11
VFilipe S. Dias, filipesdias(at)gmail.com
p12
s.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,4 @@
##Vector processing=group
##Layer = raster
##showplots
hist(as.matrix(Layer),main="Histogram",xlab="Layer")
@@ -0,0 +1,22 @@
(dp0
S'ALG_CREATOR'
p1
VFilipe S. Dias
p2
sS'Field'
p3
VA numeric field.
p4
sS'ALG_DESC'
p5
VThis tool creates a dotplot of the input numeric field using the function dotchart().\u000a
p6
sS'Layer'
p7
VA vector layer with a numeric field.
p8
sS'ALG_HELP_CREATOR'
p9
VFilipe S. Dias
p10
s.
@@ -0,0 +1,8 @@
##Point pattern analysis=group
##Layer=vector
##Nsim=number 10
##showplots
library("maptools")
library("spatstat")
ppp=as(as(Layer, "SpatialPoints"),"ppp")
plot(envelope(ppp, Fest, nsim=Nsim))
@@ -0,0 +1,26 @@
(dp0
S'ALG_DESC'
p1
VThis R script computes simulation envelopes of the F(r) - empty space function.\u000a\u000aThe empty space function (also called the \u201cspherical contact distribution\u201d or the \u201cpoint-to-nearest-event\u201d distribution) of a stationary point process X is the cumulative distribution function F of the distance from a fixed point in space to the nearest point of X. An estimate of F derived from a spatial point pattern dataset can be used in exploratory data analysis and formal inference about the pattern . In exploratory analyses, the estimate of F is a useful statistic summarising the sizes of gaps in the pattern. For inferential purposes, the estimate of F is usually compared to the true value of F for a completely random (Poisson) point process.\u000a\u000aR dependencies: library "maptools" and "spatstat"
p2
sS'ALG_CREATOR'
p3
VVictor Olaya - volaya(at)gmail.com
p4
sS'Layer'
p5
VA vector containg a point pattern.
p6
sS'Nsim'
p7
VNumber of simulated point patterns to be generated when computing the envelopes.\u000a\u000a
p8
sS'RPLOTS'
p9
VPlot with the simulation envelopes.
p10
sS'ALG_HELP_CREATOR'
p11
VFilipe S. Dias - filipesdias(at)gmail.com
p12
s.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,4 @@
##Basic statistics=group
##Layer=vector
##Field=Field Layer
>table(Layer[[Field]])
@@ -0,0 +1,26 @@
(dp0
S'ALG_DESC'
p1
VThis tool builds a frequency table using the table() function.
p2
sS'R_CONSOLE_OUTPUT'
p3
VFrequency table.
p4
sS'ALG_CREATOR'
p5
VFilipe S. Dias, filipesdias(at)gmail.com
p6
sS'Layer'
p7
VA vector layer with a numeric or string field.
p8
sS'Field'
p9
VA string or numeric field.
p10
sS'ALG_HELP_CREATOR'
p11
VFilipe S. Dias, filipesdias(at)gmail.com
p12
s.
@@ -0,0 +1,8 @@
##Point pattern analysis=group
##Layer=vector
##Nsim=number 10
##showplots
library("maptools")
library("spatstat")
ppp=as(as(Layer, "SpatialPoints"),"ppp")
plot(envelope(ppp, Gest, nsim=Nsim))
@@ -0,0 +1,26 @@
(dp0
S'ALG_DESC'
p1
VThis R script computes simulation envelopes of the G(r) - nearest neighbour distance distribution function.\u000a\u000aThe nearest neighbour distance distribution function (also called the \u201cevent-to-event\u201d or \u201cinter-event\u201d distribution) of a point process X is the cumulative distribution function G of the distance from a typical random point of X to the nearest other point of X. An estimate of G derived from a spatial point pattern dataset can be used in exploratory data analysis and formal inference about the pattern. In exploratory analyses, the estimate of G is a useful statistic summarising one aspect of the \u201cclustering\u201d of points. For inferential purposes, the estimate of G is usually compared to the true value of G for a completely random (Poisson) point process, which is where lambda is the intensity (expected number of points per unit area). Deviations between the empirical and theoretical G curves may suggest spatial clustering or spatial regularity.\u000a\u000aR dependencies: library "maptools" and "spatstat"
p2
sS'ALG_CREATOR'
p3
VVictor Olaya, volayaf(at)gmail.com
p4
sS'Layer'
p5
VA point pattern process.
p6
sS'Nsim'
p7
VNumber of simulated point patterns to be generated when computing the envelopes.
p8
sS'RPLOTS'
p9
VPlot with the simulation envelopes.
p10
sS'ALG_HELP_CREATOR'
p11
VFilipe S. Dias, filipesdias(at)gmail.com
p12
s.

This file was deleted.

@@ -0,0 +1,5 @@
##Vector processing=group
##showplots
##Layer=vector
##Field=Field Layer
hist(Layer[[Field]],main=paste("Histogram of",Field),xlab=paste(Field))
@@ -0,0 +1,14 @@
(dp0
S'Field'
p1
VA nuneric field.
p2
sS'ALG_DESC'
p3
VThis tool creates a histogram of the input numeric field using the hist() function.
p4
sS'Layer'
p5
VA vector layer with a numeric field.
p6
s.

This file was deleted.

@@ -0,0 +1,15 @@
##Home Range Analysis=group
##Layer=vector
##Field=Field Layer
##Grid=number 10
##Percentage=number 10
##Home_ranges=Output vector
##Folder=folder
library(adehabitatHR)
Layer[,Field]->relocs
kud <- kernelUD(relocs, grid=,Grid, h="href")
names(kud)->Names
for(i in 1:length(Names)){
writeGDAL(kud[[i]],paste(paste(Folder,"/",sep=""),paste(Names[i],".tiff",sep=""), sep=""),drivername="GTiff")
}
Home_ranges<- getverticeshr(kud,percent=Percentage)
@@ -0,0 +1,38 @@
(dp0
S'ALG_DESC'
p1
VThis algorithm computes the home range of one or more animals using a kernel density estimator and it uses the ad-hoc method to estimate the "h" parameter (href).\u000a\u000aR depencies: library "adehabitatHR"
p2
sS'Home_ranges'
p3
VA vector containing the home ranges corresponding to the smallest area on which the probability of relocating an animal is equal to value chosen for the "Percentage" parameter.\u000a
p4
sS'ALG_CREATOR'
p5
VFilipe S. Dias, filipesdias(at)gmail.com \u000a \u000a
p6
sS'Layer'
p7
VA vector containing the relocations of one or more animails.
p8
sS'Field'
p9
VThe field that contains the unique identifier (type "string") for each animal.
p10
sS'Grid'
p11
VThe size of the grid (number of cells) on which the utilization distribution is calculated by the kernel function.
p12
sS'ALG_HELP_CREATOR'
p13
VFilipe S. Dias, filipesdias(at)gmail.com
p14
sS'Folder'
p15
VThe ouput folder where the rasters containing the utilization distributions generated for each animal by the kernel funciton will be sent.
p16
sS'Percentage'
p17
VA single value giving the percentage level for home-range estimation. \u000a\u000aFor example, Percentage= 95 corresponds to the smallest area on which the probability to relocate the animal is equal to 0,95.
p18
s.

This file was deleted.

@@ -0,0 +1,5 @@
##Basic statistics=group
##Layer=vector
##Field=Field Layer
library(nortest)
>lillie.test(Layer[[Field]])
@@ -0,0 +1,20 @@
(dp0
S'Field'
p1
VA numeric field.
p2
sS'ALG_DESC'
p3
VThis script performs the Lilliefors (Kolmogrov-Smirnov) test for the composite hypothesis of normality.\u000a\u000aR dependencies: library "nortest"\u000a\u000a
p4
sS'R_CONSOLE_OUTPUT'
p5
VThe results of the Lilliefors (Kolmogrov-Smirnov) test.
p6
sS'Layer'
p7
VA vector containing at least one numeric field.
p8
sNV
p9
s.
@@ -0,0 +1,7 @@
##Home Range Analysis=group
##Layer=vector
##Percentage=number 10
##Field=Field Layer
##Home_ranges=Output vector
library(adehabitatHR)
Home_ranges<-mcp(Layer[,Field],percent=Percentage)

0 comments on commit 7165e88

Please sign in to comment.
You can’t perform that action at this time.