1

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?

  • In addition to R folder, I set User Library Folder to where I have R packages. I am using Processing R Provider in QGIS 3.8.3 on windows, so it may be different situation. – Kazuhito Sep 30 at 11:15
  • confirmed with QGIS 3.4.12. – Kazuhito Sep 30 at 11:34
2

This is my settings.

  1. The location R is installed.
  2. R scripts folder is accessed from Menu > Settings > User Profiles > Open Active Profile Folder.
  3. User library folder is where I have R packages.

enter image description here

Then, RSX script for Ripley's K:

enter image description here

##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):

enter image description here

File system would be different from yours, but hope this helps.

  • Hi Kazuhito, Sorry for not responding sooner. The file structure is different in Linux, but I'm trying to find the equivalents. However, I can use the r scripts so it does not matter too much. Thanks for your demo. Neil – Neil Oct 6 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.