I constructed a simple R script for QGIS modeler (.rsx) that calculates groupwise summary statistics of a vector layer table (sum by field "subject" and "FRC"). The script correctly works. When executed, a windows is opened and you can manually choose the vector layer and the other parameters. However, if I insert this script in the graphical modeler I am able to choose the output of a previous Algorithm as input to my script, nevertheless I cannot select fields from its attribute table, as requested by my script.
How can I do that?
As an example, consider I want to construct a model that calculates the % of different land use types inside polygon buffers constructed around some street addresses.
The model represented in the picture below intersect the buffers with a polygon layer representing land use areas, then calculates the area of each new feature in the intersection layer.
Now I want to link my R-script to the output layer "Intersection_with_area" to summarize the total area for each address and for each land use type. Here below the .rsx code:
##intersection=vector ##address=field intersection ##soiltype=field intersection ##area=field intersection ##folder=string ##filename=string library(doBy) setwd(as.character(folder)) inters_df=as.data.frame(intersection) summ=summaryBy(list(area,c(address,soiltype)),FUN=sum, data=inters_df, keep.names=T) write.csv(summ,as.character(nomefile))
I am unable to select the fields "address", "area" and "soiltype" from the vector layer "Intersection_with_area" that is in my model.