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

> ### Name: cor.pair
> ### Title: compute the correlation between two genes
> ### Aliases: cor.pair gcc.cor.pair gcc.corpair
> ### Keywords: correlation
> 
> ### ** Examples
> 
> 
>    data(rsgcc)        #load the sample data in rsgcc package
>    x <- rnaseq[1:4,]  #construct a GEMatrix with the RNA-Seq data of the first four genes
> 
>    #compute correlation between the 1st and 4th genes
>    corpair <- cor.pair(c(1,4), GEMatrix = x, rowORcol = "row", 
+                        cormethod = "GCC", pernum = 0, 
+                        sigmethod = "two.sided")  
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
rsgcc
 --- call from context --- 
cor.pair(c(1, 4), GEMatrix = x, rowORcol = "row", cormethod = "GCC", 
    pernum = 0, sigmethod = "two.sided")
 --- call from argument --- 
if (class(GEMatrix) != "matrix") {
    stop("Error: GEMatrix should be a numeric data matrix")
}
 --- R stacktrace ---
where 1: cor.pair(c(1, 4), GEMatrix = x, rowORcol = "row", cormethod = "GCC", 
    pernum = 0, sigmethod = "two.sided")

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (idxvec, GEMatrix, rowORcol = c("row", "col"), cormethod = c("GCC", 
    "PCC", "SCC", "KCC", "BiWt"), pernum = 0, sigmethod = c("two.sided", 
    "one.sided")) 
{
    onegcc <- function(x, y) {
        getrank <- function(datamatrix) {
            if (dim(datamatrix)[1] != 2) {
                stop("Error: the row num of datamatrix must be 2")
            }
            OrderIndex <- order(datamatrix[1, ], decreasing = FALSE)
            SortGenePair <- datamatrix[, OrderIndex]
            Sort2By1 <- SortGenePair[2, ]
            return(list(Sort2By1 = Sort2By1, Sort2By2 = sort(datamatrix[2, 
                ], decreasing = FALSE)))
        }
        gcc <- function(weightvec, vectsort, vectselfsort) {
            Sum1 <- sum(weightvec * vectsort)
            Sum2 <- sum(weightvec * vectselfsort)
            if (Sum2 == 0) {
                cat("\n", x, "\n", y, "\n")
                cat("Warning: the Denominator is ZRRO, the value of one variable is consistent.")
                gcccor <- 0
            }
            else {
                gcccor <- Sum1/Sum2
            }
            return(gcccor)
        }
        Length <- length(x)
        Wt <- t(2 * seq(1, Length, by = 1) - Length - 1)
        GenePairXY <- t(matrix(c(x, y), ncol = 2))
        SortYlist <- getrank(GenePairXY)
        gcc.rankx <- gcc(Wt, SortYlist$Sort2By1, SortYlist$Sort2By2)
        return(gcc.rankx)
    }
    if (!is.vector(idxvec) | length(idxvec) != 2) {
        stop("Error: idxvec must be a vector with two elements indicating the indexs(rows) in GEMatrix")
    }
    if (class(GEMatrix) != "matrix") {
        stop("Error: GEMatrix should be a numeric data matrix")
    }
    if (rowORcol == "row") {
        x1 <- GEMatrix[idxvec[1], ]
        y1 <- GEMatrix[idxvec[2], ]
    }
    else if (rowORcol == "col") {
        x1 <- GEMatrix[, idxvec[1]]
        y1 <- GEMatrix[, idxvec[2]]
    }
    else {
        stop("Error: rowORcol must be \"row\" or \"col\"")
    }
    getcor <- function(g1, g2, cormethod) {
        if (cormethod == "PCC") {
            return(cor.test(g1, g2, method = "pearson")$estimate)
        }
        else if (cormethod == "SCC") {
            return(cor.test(g1, g2, method = "spearman")$estimate)
        }
        else if (cormethod == "KCC") {
            return(cor.test(g1, g2, method = "kendall")$estimate)
        }
        else if (cormethod == "BiWt") {
            return(biwt.cor(t(matrix(c(g1, g2), ncol = 2)), output = "vector")[1])
        }
        else if (cormethod == "GCC") {
            return(list(gcc.rankx = onegcc(g1, g2), gcc.ranky = onegcc(g2, 
                g1)))
        }
    }
    getpvalue <- function(percorvec, pernum, realcor, sigmethod) {
        pvalue <- length(which(percorvec >= realcor))/pernum
        if (pvalue == 0) 
            pvalue <- 1/pernum
        if (pvalue > 0.5) 
            pvalue <- 1 - pvalue
        if (sigmethod == "two.sided") {
            pvalue <- 2 * pvalue
        }
        return(pvalue)
    }
    if (length(cormethod) > 1) {
        stop("Error: length of cormethod must be of length 1")
    }
    if (!is.vector(x1) || !is.vector(y1)) {
        stop("Error: input two vectors for gcc.corpair")
    }
    if (!is.numeric(x1) || !is.numeric(y1)) {
        stop("Error: x should be numeric")
    }
    if (length(which(is.na(x1) == TRUE)) > 0 || length(which(is.na(y1) == 
        TRUE)) > 0) {
        stop("Error: There are Na(s) in x")
    }
    if (length(x1) != length(y1)) {
        stop("Error: the lengths of each row in x are different.\n")
    }
    realcor <- getcor(x1, y1, cormethod)
    if (pernum <= 0) {
        if (cormethod == "GCC") {
            return(list(gcc.rankx = realcor$gcc.rankx, gcc.ranky = realcor$gcc.ranky, 
                gcc.rankx.pvalue = NA, gcc.ranky.pvalue = NA))
        }
        else {
            return(list(cor = realcor, pvalue = NA))
        }
    }
    else {
        pGCCMatrix <- matrix(0, nrow = pernum, ncol = 2)
        colnames(pGCCMatrix) <- c("gcc.rankx", "gcc.ranky")
        rownames(pGCCMatrix) <- paste("permut", seq(1, pernum, 
            by = 1), sep = "")
        GenePairXY <- t(matrix(c(x1, y1), ncol = 2))
        pGenePairXY <- GenePairXY
        Length <- length(x1)
        for (i in 1:pernum) {
            curtime <- format(Sys.time(), "%H:%M:%OS4")
            XXX <- unlist(strsplit(curtime, ":"))
            curtimeidx <- (as.numeric(XXX[1]) * 3600 + as.numeric(XXX[2]) * 
                60 + as.numeric(XXX[3])) * 10000
            set.seed(curtimeidx)
            TT = sort(runif(Length), index.return = TRUE)$ix
            pGenePairXY[1, ] <- GenePairXY[1, TT]
            if (cormethod == "GCC") {
                cortmp <- getcor(pGenePairXY[1, ], pGenePairXY[2, 
                  ], cormethod)
                pGCCMatrix[i, 1] <- cortmp$gcc.rankx
                pGCCMatrix[i, 2] <- cortmp$gcc.ranky
            }
            else {
                pGCCMatrix[i, 1] <- getcor(pGenePairXY[1, ], 
                  pGenePairXY[2, ], cormethod)
            }
        }
        if (cormethod == "GCC") {
            return(list(gcc.rankx = realcor$gcc.rankx, gcc.ranky = realcor$gcc.ranky, 
                gcc.rankx.pvalue = getpvalue(pGCCMatrix[, 1], 
                  pernum, realcor$gcc.rankx, sigmethod), gcc.ranky.pvalue = getpvalue(pGCCMatrix[, 
                  2], pernum, realcor$gcc.ranky, sigmethod)))
        }
        else {
            return(list(cor = realcor, pvalue = getpvalue(pGCCMatrix[, 
                1], pernum, realcor, sigmethod)))
        }
    }
}
<bytecode: 0xc486d18>
<environment: namespace:rsgcc>
 --- function search by body ---
Function cor.pair in namespace rsgcc has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(GEMatrix) != "matrix") { : 
  the condition has length > 1
Calls: cor.pair
Execution halted