Tuesday, 22 January 2013

manageR, a usefull plugin for QGIS

manageR is a QGIS plugin providing a simple and usefull interface to R statistical programming environment (http://www.r-project.org/). It is created by Carson J. Q. Farmer (http://www.ftools.ca/manageR) and is downloadable from this repository: http://www.ftools.ca/cfarmerQgisRepo.xml. To install it in QGIS is enough add such repository in QGIS Python Plugin Installer (Plugins → Fetch Python Plugins).

One of the most interesting things is that you can take data directly from the .dbf table of the shapefile layer loaded in QGIS and process them in R environment. Usually, when I work with PostgreSQL/PostGIS or SQLite/SpatiaLite for managing attributes table of vector layers, I connect directly database with R using RODBC or RSQLite packages. But if I have to use shapefiles and their .dbf tables, manageR could be a good solution, specially for fast and simple works.

Here, I would like to present a small example of plugin's use. In QGIS I created a distribution map of Roman funerary sites in Trentino-Alto Adige region (Northern Italy). The sites (blue dots) are registered in a simple shapefile and every single point is associated to a record stored in a .dbf table. As usual, the .dbf table is divided in several columns each of which contains different attributes about sites (ID, coordinates, height, date, etc.).


I need to plot an histogram of heights above sea level to get an immediate view of sites distribution based on heights. I can launch manageR from QGIS.


At first sight, manageR is a simple GUI that includes R command line, some toolbars for managing data, graphic devices, history, etc. and several buttons to make some of the most common statistical analysis.
As I said, in manageR I can import layer attributes with button “Action → Import Layers Attribute” (or CTRL+T) and then I can select the column I need (in my case, “height”) using R language.


Typing in R command line or using button “Analysis” in main toolbar, I can select and launch the statistical function I need and plot the diagram; in my example I plotted an histogram of heights a.s.l. of my funerary sites.



This is a simple example, but manageR plugin could be a very usefull tool for archaeologists, also for more complex works. Its main advantage is that it works directly with .dbf table, avoiding the export of data or the opening of .dbf file in Calc/Excel.

by Denis Francisci
BlogItalia - La directory italiana dei blog Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.