R/homogenize.to.parentals.R

Defines functions homogenize.to.parentals

Documented in homogenize.to.parentals

homogenize.to.parentals <-
function(x, parents, window){
  #d1 <- data.frame(matrix(parents, nrow=1))
  
  alls <- numeric()
  for(i in 1:length(x$wei)){
    bb <- abs(x$wei[i] - parents)
    bb2 <- which(bb < window)[1]
    if(is.na(bb2)){
      alls[i] <- x$wei[1]
    }else{alls[i] <- parents[[bb2]]}
    
  }
  x$wei <- alls
  # returns alleles but in parental conformation
  return(x)
}

Try the Fragman package in your browser

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

Fragman documentation built on May 29, 2017, 5:21 p.m.