R/makeTreeset.R

# makeTreeset.R
library("hash")
treeTypes = list("beast", "mrbayes", "paml", "r8s", "raxml", "nhx",
                 "phylip", "epa")

#' Make a hash with all tree values initialized to 0.
#'
#'@return hash of trees with all keys the types of trees and all values 0.
#'@examples
#'emptyTreeset = makeTreeset()
makeTreeset <- function() {
  treeset <- hash()
  for(i in treeTypes){
    treeset[[i]] <- 0
  }
  return(treeset)
}

# Citations:
# https://stackoverflow.com/questions/7818970/is-there-a-dictionary-functionality-in-r
# https://www.datamentor.io/r-programming/environment-scope/
# https://stackoverflow.com/questions/26297024/how-to-loop-through-a-list-in-r/26298528
raywoo32/phylogetree documentation built on May 14, 2019, 7:22 p.m.