R/Str.R

Defines functions Str

Documented in Str

#### Deifine hierarchical structure for genetic data

Str = function(nreg, r, n) {
    Str = data.frame(matrix(data = 0, ncol = n, nrow = 3))  #
    Str[1, ] = c(rep("ecosystem", times = n))
    # should be equal to nreg
    if (length(r) != nreg)
        stop("number of regions should be equal to the number of  r  defined")
    Str[2, ] = c(rep(paste0("region", 1:nreg), r))
    Str[3, ] = c(paste("pop", 1:n))
    Str = as.matrix(Str)
    return(Str)
}

Try the HierDpart package in your browser

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

HierDpart documentation built on March 31, 2021, 5:09 p.m.