Running examples in ‘popkin-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: fst
> ### Title: Calculate FST from a population-level kinship matrix or vector
> ###   of inbreeding coefficients
> ### Aliases: fst
> 
> ### ** Examples
> 
> # Get FST from a genotype matrix
> 
> # Construct toy data
> X <- matrix(c(0,1,2,1,0,1,1,0,2), nrow = 3, byrow = TRUE) # genotype matrix
> subpops <- c(1,1,2) # subpopulation assignments for individuals
> 
> # NOTE: for BED-formatted input, use BEDMatrix!
> # "file" is path to BED file (excluding .bed extension)
> ## library(BEDMatrix)
> ## X <- BEDMatrix(file) # load genotype matrix object
> 
> # estimate the kinship matrix "kinship" from the genotypes "X"!
> kinship <- popkin(X, subpops) # calculate kinship from X and optional subpop labels
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
popkin
 --- call from context --- 
popkin(X, subpops)
 --- call from argument --- 
if (class(X) != "function") {
    if (class(X) == "BEDMatrix") {
        n2 <- nrow(X)
    }
    else if (class(X) == "matrix") {
        if (loci_on_cols) {
            n2 <- nrow(X)
        }
        else {
            n2 <- ncol(X)
        }
    }
    else stop("genotype matrix `X` has unsupported class: ", 
        class(X))
    if (n != n2) 
        stop("the length of `subpops` (", n, ") disagrees with the number of individuals in the genotype matrix (", 
            n2, ")")
}
 --- R stacktrace ---
where 1: popkin(X, subpops)

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (X, subpops = NULL, n = NA, loci_on_cols = FALSE, mem_lim = NA, 
    lociOnCols = FALSE, memLim = NA) 
{
    if (lociOnCols && !loci_on_cols) {
        warning("`lociOnCols` is deprecated, please use `loci_on_cols` instead!")
        loci_on_cols <- lociOnCols
    }
    if (!is.na(memLim) && is.na(mem_lim)) {
        warning("`memLim` is deprecated, please use `mem_lim` instead!")
        mem_lim <- memLim
    }
    if (!is.null(subpops)) {
        if (is.na(n)) {
            n <- length(subpops)
        }
        else if (n != length(subpops)) {
            stop("the length of `subpops` (", length(subpops), 
                ") disagreed with the input `n` (", n, ")")
        }
        if (class(X) != "function") {
            if (class(X) == "BEDMatrix") {
                n2 <- nrow(X)
            }
            else if (class(X) == "matrix") {
                if (loci_on_cols) {
                  n2 <- nrow(X)
                }
                else {
                  n2 <- ncol(X)
                }
            }
            else stop("genotype matrix `X` has unsupported class: ", 
                class(X))
            if (n != n2) 
                stop("the length of `subpops` (", n, ") disagrees with the number of individuals in the genotype matrix (", 
                  n2, ")")
        }
    }
    A <- get_A(X, n = n, loci_on_cols = loci_on_cols, mem_lim = mem_lim)
    A_min <- min_mean_subpops(A, subpops)
    kinship <- 1 - A/A_min
}
<bytecode: 0x55f1adde0298>
<environment: namespace:popkin>
 --- function search by body ---
Function popkin in namespace popkin has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1