R/getStandardParentIdsAsDataFrame.R

Defines functions getStandardParentIdsAsDataFrame

getStandardParentIdsAsDataFrame <- function(taxonomyIds = NULL, taxadumprObject = NULL) {
  childIds <- unique(taxonomyIds)
  parentdIds <- sapply(childIds, function(childId) {
    childDf <- taxdumpr::getStandardLineageIdsByIds(taxadumprObject, childId)
    parentIndex <- nrow(childDf) - 1
    childDf$lineageId[parentIndex]
  })
  returnDf <- data.frame(taxonomyId = childIds, parentId = parentdIds)
  returnDf
}
felipepratalima/gunga documentation built on Aug. 16, 2019, 10:14 p.m.