Skip to content

Instantly share code, notes, and snippets.

@wilkox
Created January 2, 2017 01:13
Show Gist options
  • Save wilkox/15d611dbd57fe2f4fd981d4708e1fb12 to your computer and use it in GitHub Desktop.
Save wilkox/15d611dbd57fe2f4fd981d4708e1fb12 to your computer and use it in GitHub Desktop.
# Vectorised version of ggtree::expand
require(ggtree)
expand_vectorised <- function(tree_view = NULL, nodes) {
if (length(nodes) == 1) {
return(ggtree::expand(tree_view, nodes))
} else {
return(ggtree::expand(
expand_vectorised(tree_view, nodes[-1]),
nodes[1]
))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment