Cross tables in R, some ways to do it faster

In R to create a contingency table of the counts of the combination of two variables, I would normally resort to table(). But how fast is it? A question that becomes more relevant when working on large tables and when you have to run it very often. As you will see in the examples below, it isn’t terribly fast and there are other ways to create cross tables faster. Continue reading

GRASS GIS: creating cross products of multiple raster map layers

I am looking at vegetation distribution in east Africa, using a map we have developed based on historical vegetation maps from the region, and I wanted to know the surface area per vegetation type per country. In ‘spreadsheet terms’, I wanted to create a cross- or pivot table. GRASS GIS offers several options to do this. Note that below I am using the examples provided in the help files of the functions. Check out these help files for further details. Continue reading