Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)!, and hours of head-scratching, I created this R package, jsPhyloSVG that provides an htmlwidget for the library of the same name. An example follows

# I'll be using the ape package to simulate a tree
library(ape)
# You can get it from github USCBiostats/jsPhyloSVG
library(jsPhyloSVG)

# A random phylogenetic tree with 50 tips
tree <- rtree(50)

jsPhyloSVG(write.tree(tree))

You can take a look at the project repo here.