R/get_maternal_ancestors.R

Defines functions get_maternal_ancestors

Documented in get_maternal_ancestors

#' Get list of maternal ancestors
#'
#' Returns a vector starting with id and ending with most distant maternal ancestor. This function uses tblHyenas
#'
#' @param id A string specifying the hyena id
#'
#' @examples
#'
#' @export
#'

get_maternal_ancestors <- function(id){
  if(is.na(tblHyenas[tblHyenas$id == id, 'mom'])){
    return(id)
  }else{
    return(c(id, get_maternal_ancestors(tblHyenas[tblHyenas$id == id, 'mom'])))
  }
}
MaraHyenaProject/hyenatools documentation built on Jan. 30, 2025, 5:10 p.m.