Geographic Information Systems Asked on February 1, 2021
System Ubuntu 19.10, QGIS 3.4
I am trying to utilise R in QGIS for Ripley’s K function.
The sample R script ‘Scatterplot’ works with the Processing R Provider plugin, which indicates r-base is installed OK. However, I have installed the Spatstat package and the various categories do not appear in the QGIS Processing Toolbox.
I am guessing the R scripts folder needs setting? If so, what would I need to direct the plugin to?
This is my settings.
Menu > Settings > User Profiles > Open Active Profile Folder
.Then, RSX script for Ripley's K:
##Kazuhito Vector Analysis=group
##Layer=vector point
##showplots
library("maptools")
library("spatstat")
points=as.ppp(Layer)
K=Kest(points)
plot(K)
It gives me this html output (via Results Viewer panel):
File system would be different from yours, but hope this helps.
Answered by Kazuhito on February 1, 2021
Version 0.9.0 of the Resource Sharing plugin was made available on http://plugins.qgis.org today (https://plugins.qgis.org/plugins/qgis_resource_sharing), and the good news is that it includes support for R script collections. See https://gis.stackexchange.com/a/341008/22646 for more details, and for information about available collections and repositories.
The QGIS Official Repository now also includes a collection with R scripts. The name of the collection is QGIS R script collection.
(modified according to recent developments in the official QGIS repository)
It is currently not possible to "import" R scripts from the on-line collection (as could be done in QGIS 2), but it is possible to download the scripts and add them "manually". See https://gis.stackexchange.com/a/341008/22646.
The "QGIS Resource Sharing" plugin supports import of R script collections. I have done some testing by creating a resource for the plugin that contains these QGIS 2 R scripts.
Using the following steps, I was able to get this to work in QGIS 3.10.1 (I suppose it should work also with QGIS 3.4).
QGIS R script collection
in the list to install R scripts that work in QGIS 3 with Processing R provider 2 (select QGIS R script collection (from QGIS 2)
if you want the original QGIS 2 collection - many of these scripts need to be modified to work), click on the
Install buttonWith recent versions (>= 0.9.0) of the QGIS Resource Sharing plugin the R scripts should now be available under various groups under R in the processing toolbar (see illustration below).
With older versions (< 0.9.0) of the plugin, you also have to:
Open the Processing settings (Settings-> Options-> Processing tab)
Go to Providers-> R-> R scripts folder
On Ubuntu, set the path to (or include in the path):
/home/<user>/.local/share/QGIS/QGIS3/profiles/default/resource_sharing/repositories/github.com/havatv/qgis_rscripts/collections/R-scripts-QGIS2/processing/rscriptsqgis2
On Windows, set the path to:
C:Users<user>AppDataRoamingQGISQGIS3profilesdefaultresource_sharingrepositoriesgithub.comhavatvqgis_rscriptscollectionsR-scripts-QGIS2processingrscriptsqgis2
It is possible to provide several directories here, separated by a semicolon (";").
All the R scrips from the QGIS 2 on-line collection should now be available in the Processing Toolbox (only some of the groups are expanded in the screenshot below):
The scripts at the top come from the default rscripts folder -
it is included in my R scripts folder
path.
Answered by Håvard Tveite on February 1, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP