<div dir="ltr"><div>Hi every one, I'm having a hard time with Sextante and R. I'm trying to make a little script to calculate the sum of a variable per cathegory, the script runs in R, but I can't understand how to make it work in QGIS... <br><br></div><div>I haven't found many examples on QGIS-R, and the few ones use only one variable...<br><br></div><div>Any help is welcome (any documentation or examples are very welcome), <br></div><div>Thanks,<br></div><div>Daniel<br></div><div><br></div><div><br></div><div><br><br>##Basic statistics=group<br>##Layer=vector<br>##valores=Field Layer<br>##categorias=Field Layer<br>valores<-Layer[[valores]]<br>categorias<-Layer[[categorias]]<br>catego<-as.factor(categorias)<br>catego_unicos<-unique(catego)<br>suma<-NA;suma<-data.frame(suma)<br>for(i in 1:length(catego_unicos)){<br>suma[i,1]<-sum(valores[catego==catego_unicos[i]])<br>}<br>colnames(suma)<-"suma"<br>rownames(suma)<-catego_unicos<br>>suma<br><br></div></div>