R/splitvec.from.bfile.R

Defines functions splitvec.from.bfile

Documented in splitvec.from.bfile

splitvec.from.bfile <- function(bfile) {
  #' Function to create split vectors from the info in vectors of bfiles
  #' @keywords internal
  pvec <- attr(bfile, "p")
  Pvec <- attr(bfile, "P")
  if(is.null(pvec) || is.null(Pvec)) {
    stop("Since v0.4.3 bfile should have the attributes 'p' and 'P' if it is a vector")
  } else {
    stopifnot(length(pvec) == length(bfile))
    stopifnot(length(Pvec) == length(bfile))
  }
  
  return(list(split_p=rep(1:length(bfile), attr(bfile, "p")), 
              split_P=rep(1:length(bfile), attr(bfile, "P"))))
  
}
tshmak/lassosum documentation built on Sept. 24, 2020, 9:41 a.m.