[Qgis-developer] R in Processing: errors not shown

matteo matteo.ghetta at gmail.com
Mon Mar 13 07:17:25 PDT 2017


> this did not happen in my case

ok, not sure if this is related to this mandatory R packages

> after installing them, the error is gone, and the entries appear on the list

ok, do you have ggplot2 installed? If not, try to import the attached
script (copy and paste the content in the editor) and try to use it

if it works and you did not had ggplot2 installed then Processing is
able to install additional packages, if not, then I'm totally wrong :)

Matteo
-------------- next part --------------
##[R-Geostatistics]=group
##showplots
##Layer=vector
##X=Field Layer
##Group=optional Field Layer
#Log_Scale = boolean False
##Data_Transformation=selection normal;log10;ln;sqrt;exp

require(ggplot2)


if(Data_Transformation == 0){
ax <- scale_y_continuous()
yy <- ylab(X)
} else if(Data_Transformation == 1){
ax <- scale_y_log10()
yy <- ylab(paste("log10", X))
} else if(Data_Transformation == 2){
ax <- coord_trans(y = "log")
yy <- ylab(paste("ln", X))
} else if(Data_Transformation == 3){
ax <- coord_trans(y = "sqrt")
yy <- ylab(paste("sqrt", X))
} else if(Data_Transformation == 4){
ax <- coord_trans(y = "exp")
yy <- ylab(paste("exp", X))
}

if(is.null(Group)){
ggplot()+
geom_boxplot(aes(x=1, y=Layer[[X]]))+
xlab("")+
yy +
ax +
ggtitle(paste("Boxplot of", X))
} else {
ggplot()+
geom_boxplot(aes(x=Layer[[Group]], y=Layer[[X]], fill=as.factor(Layer[[Group]])))+
xlab(Group)+
yy +
scale_fill_discrete(name=Group) +
ax +
ggtitle(paste("Boxplot of", X))
}


More information about the Qgis-developer mailing list