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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: Get_Logistic_Weights
> ### Title: Get the logistic weight
> ### Aliases: Get_Logistic_Weights Get_Logistic_Weights_MAF
> 
> ### ** Examples
> 
> 
> 
> data(SKAT.example)
> attach(SKAT.example)
> 
> 
> #############################################################
> #	Compute the P-value of SKAT with the logistic Weight (par1=0.07, par2=150)
> 
> # Use logistic weight
> obj<-SKAT_Null_Model(y.c ~ X, out_type="C")
> weights<-Get_Logistic_Weights(Z, par1=0.07, par2=150)
> SKAT(Z, obj, kernel = "linear.weighted", weights=weights)$p.value
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
SKAT
 --- call from context --- 
SKAT_MAIN_Check_Z(Z, obj.res$n.all, obj.res$id_include, SetID, 
    weights, weights.beta, impute.method, is_check_genotype, 
    is_dosage, missing_cutoff, max_maf = max_maf, estimate_MAF = estimate_MAF)
 --- call from argument --- 
if (class(Z) != "matrix") stop("Z is not a matrix")
 --- R stacktrace ---
where 1: SKAT_MAIN_Check_Z(Z, obj.res$n.all, obj.res$id_include, SetID, 
    weights, weights.beta, impute.method, is_check_genotype, 
    is_dosage, missing_cutoff, max_maf = max_maf, estimate_MAF = estimate_MAF)
where 2: SKAT_With_NullModel(Z, obj, kernel = kernel, method = method, 
    weights.beta = weights.beta, weights = weights, impute.method = impute.method, 
    r.corr = r.corr, is_check_genotype = is_check_genotype, is_dosage = is_dosage, 
    missing_cutoff = missing_cutoff, max_maf = max_maf, estimate_MAF = estimate_MAF)
where 3: SKAT(Z, obj, kernel = "linear.weighted", weights = weights)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (Z, n, id_include, SetID, weights, weights.beta, impute.method, 
    is_check_genotype, is_dosage, missing_cutoff, max_maf, estimate_MAF = 1, 
    Is.chrX = FALSE, SexVar = NULL) 
{
    if (class(Z) != "matrix") 
        stop("Z is not a matrix")
    if (nrow(Z) != n) 
        stop("Dimensions of y and Z do not match")
    if (is_dosage == TRUE) {
        impute.method = "fixed"
    }
    if (!is_check_genotype && !is_dosage) {
        Z.test <- Z[id_include, ]
        if (!is.matrix(Z.test)) {
            Z.test <- as.matrix(Z.test)
        }
        return(list(Z.test = Z.test, weights = weights, MAF = rep(0, 
            ncol(Z)), return = 0))
    }
    if (estimate_MAF == 2) {
        Z <- cbind(Z[id_include, ])
        id_include <- 1:length(id_include)
    }
    IDX_MISS <- union(which(is.na(Z)), which(Z == 9))
    if (length(IDX_MISS) > 0) {
        Z[IDX_MISS] <- NA
    }
    m = ncol(Z)
    ID_INCLUDE_SNP <- NULL
    MAF_toCutoff <- SKAT_Get_MAF(Z, id_include = NULL, Is.chrX = Is.chrX, 
        SexVar = SexVar)
    for (i in 1:m) {
        missing.ratio <- length(which(is.na(Z[, i])))/n
        sd1 <- sd(Z[, i], na.rm = TRUE)
        if (missing.ratio < missing_cutoff && sd1 > 0) {
            if (MAF_toCutoff[i] < max_maf) {
                ID_INCLUDE_SNP <- c(ID_INCLUDE_SNP, i)
            }
        }
    }
    if (length(ID_INCLUDE_SNP) == 0) {
        if (is.null(SetID)) {
            msg <- sprintf("ALL SNPs have either high missing rates or no-variation. P-value=1")
        }
        else {
            msg <- sprintf("In %s, ALL SNPs have either high missing rates or no-variation. P-value=1", 
                SetID)
        }
        warning(msg, call. = FALSE)
        re <- list(p.value = 1, p.value.resampling = NA, Test.Type = NA, 
            Q = NA, param = list(n.marker = 0, n.marker.test = 0), 
            return = 1)
        return(re)
    }
    else if (m - length(ID_INCLUDE_SNP) > 0) {
        if (is.null(SetID)) {
            msg <- sprintf("%d SNPs with either high missing rates or no-variation are excluded!", 
                m - length(ID_INCLUDE_SNP))
        }
        else {
            msg <- sprintf("In %s, %d SNPs with either high missing rates or no-variation are excluded!", 
                SetID, m - length(ID_INCLUDE_SNP))
        }
        warning(msg, call. = FALSE)
        Z <- as.matrix(Z[, ID_INCLUDE_SNP])
    }
    MAF_Org <- SKAT_Get_MAF(Z, id_include = NULL, Is.chrX = Is.chrX, 
        SexVar = SexVar)
    Z <- SKAT_MAIN_Check_Z_Impute(Z, id_include, impute.method, 
        SetID, Is.chrX, SexVar)
    MAF <- SKAT_Get_MAF(Z, id_include = NULL, Is.chrX = Is.chrX, 
        SexVar = SexVar)
    MAF1 <- SKAT_Get_MAF(Z, id_include = id_include, Is.chrX = Is.chrX, 
        SexVar = SexVar)
    if (length(which(MAF1 > 0)) == 0) {
        if (is.null(SetID)) {
            msg <- sprintf("No polymorphic SNP. P-value = 1")
        }
        else {
            msg <- sprintf("In %s, No polymorphic SNP. P-value = 1", 
                SetID)
        }
        warning(msg, call. = FALSE)
        re <- list(p.value = 1, p.value.resampling = NA, Test.Type = NA, 
            Q = NA, param = list(n.marker = 0, n.marker.test = 0), 
            return = 1)
        return(re)
    }
    if (is.null(weights)) {
        weights <- Beta.Weights(MAF, weights.beta)
    }
    else {
        weights = weights[ID_INCLUDE_SNP]
    }
    if (n - length(id_include) > 0) {
        id_Z <- which(MAF1 > 0)
        if (length(id_Z) == 0) {
            if (is.null(SetID)) {
                msg <- sprintf("No polymorphic SNP. P-value = 1")
            }
            else {
                msg <- sprintf("In %s, No polymorphic SNP. P-value = 1", 
                  SetID)
            }
            warning(msg, call. = FALSE)
            re <- list(p.value = 1, p.value.resampling = NA, 
                Test.Type = NA, Q = NA, param = list(n.marker = 0, 
                  n.marker.test = 0), return = 1)
        }
        else if (length(id_Z) == 1) {
            Z <- cbind(Z[, id_Z])
        }
        else {
            Z <- Z[, id_Z]
        }
        if (!is.null(weights)) {
            weights <- weights[id_Z]
        }
    }
    if (dim(Z)[2] == 1) {
        if (is.null(SetID)) {
            msg <- sprintf("Only one SNP in the SNP set!")
        }
        else {
            msg <- sprintf("In %s, Only one SNP in the SNP set!", 
                SetID)
        }
        Z.test <- as.matrix(Z[id_include, ])
    }
    else {
        Z.test <- Z[id_include, ]
    }
    return(list(Z.test = Z.test, weights = weights, MAF = MAF_Org, 
        id_include.test = id_include, return = 0))
}
<bytecode: 0x557509d35300>
<environment: namespace:SKAT>
 --- function search by body ---
Function SKAT_MAIN_Check_Z in namespace SKAT has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(Z) != "matrix") stop("Z is not a matrix") : 
  the condition has length > 1
Calls: SKAT -> SKAT_With_NullModel -> SKAT_MAIN_Check_Z
Execution halted