Working with sparse matrices in C++

Sparse matrices in RcppArmadillo can be a very useful resource to work with, especially when you are dealing with social networks. Here I provide a couple of examples in which we can take advantage of their structure by using iterators.

Visualizing Phylogenetic Trees with R and jsPhyloSVG

During the last year I’ve been working on a daily basis with phylogenetic trees, objects that in graph jargon are called Directed Acyclic Graphs. While R does have some cool packages out there to visualize these–including phylocanvas which looks great!–I wanted to tryout jsPhyloSVG, and moreover, to learn how to use htmlwidgets. So, after a week-long process of playing with JavaScript, of which I had no prior knowledge (so thank you W3shools)!

Read viz attributes from GEXF files

So one of the new features that I’ve working on is processing viz attributes. In the CRAN version of rgexf, the function read.gexf only reads in non-visual attributes and the graph structure itself, which is no longer true as of today (at least for the static viz attributes, all the other dynamic features supported by GEXF will come in the future). We start by loading the R packages and reading the “lesmiserables.

Some notes on my first shiny app

Since there are plenty of examples out there telling you how to get started with shiny (like Rstudio’s, or Google), I will focus on telling some of the stuff that I did learned and may not be obvious at first, including some of the mistakes I made. Before start, I just want to stress that I’m writing this after my first shiny app, you’ve been warned! Here it goes: Use the “two-file” method Instead of putting everything, UI and Server, in a single app.

New versions of ABCoptim and googlePublicData on CRAN

Finally, after a long wait, the R packages googlePublicData (more than 2 years since the last update!) and ABCoptim (roughly a year since the last update) have new versions on CRAN.

Reboot of rgexf

The rgexf R package has been around a couple of years now, but without much going on on CRAN (my bad!). In this post I’ll show how to use the new version (on development and soon the be shipped to CRAN) together with the netdiffuseR R package to visualize a random diffusion process.

Environments in R Rock

In this post I provide a short example in which default arguments are specified not in the function definition, but rather externally making use of environments. A method that I’ve use recently used in netdiffuseR.

Yet another plot of R's colors()

Just another matrix with the colors()’s colors

Setting up optional OpenMP support with RcppArmadillo

Setting up an R package that supports OpenMP can be a bit awkward. While systems like Ubuntu with g++ have straight forward support for -fopenmp flags, the same may not be true un MacOS’s clang, since the latter is not shipped with it. In order to solve this, it is necesary to have different src/Makevars file depending on whether the compiler supports OpenMP or not. This can be solved using a configure file, more over, autoconf.