2

I am using QGIS 2.18.21 and running an R script which needs various files as inputs. The number of files to be inputted is also entered by user. I am thinking of taking the input of all file paths in an array. I am aware that in QGIS, we must specify the type of input at the beginning of script using ##. I have tried the following:

## file_arr = array
## file_array = list

but I got strange errors. The script didn't even run at all. For example, with a script as simple as the following:

##arr=array
print(arr)

I got the error: enter image description here

and on clicking the View mesage log, I got the following: enter image description here

Now, first of all I have no idea why is this a Python error since I am running a R script, and secondly there is no proper documentation of how to specify the input of different R data types in QGIS. Please help me out to take an array as input.

1 Answer 1

1
  1. first of all I have no idea why is this a Python error since I am running a R script

Processing is a Python module that uses subprocess to run R scripts, and so, it's a Python error

  1. there is no proper documentation of how to specify the input of different R data types

You can only use the parameter types that are supported in R processing scripts (Use R scripts in Processing) and those of Writing new Processing algorithms as python scripts (look at Python headers in R scripts for QGIS)

##arr=string
print(arr)

Examine the example scripts of QGIS-Processing/rscripts/ for example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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