R/rawProfile.R

`rawProfile` <-
function (ancestorsLst, ontoLevelsLst, zeros=FALSE)
{
  
# New version :  changed so that zeros are included in the raw profile
#                zeros will be removed at an upper level (at 'oneProfile' function)
  
  rawProf <- sapply(ontoLevelsLst, function(x) sum(ancestorsLst==x))
  
#  rawProf <- table(ancestorsLst)
#   rawProf <- rawProf[names(rawProf) %in% ontoLevelsLst]
#   if(zeros==TRUE){
#        noElements <-ontoLevelsLst[is.na(match(ontoLevelsLst,ancestorsLst))]
#        emptyCats<-vector(mode="numeric", length=length(noElements))
#        names(emptyCats) <- noElements
#        rawProf<-c(rawProf, emptyCats)
#        rawProf<-rawProf[order(names(rawProf))]}
   return(rawProf)
}

Try the goProfiles package in your browser

Any scripts or data that you put into this service are public.

goProfiles documentation built on Nov. 8, 2020, 8:12 p.m.