| 1 | 
| x | |
| type | 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
## The function is currently defined as
function (x, type = "pval") 
{
    tp <- x[[1]]
    thr <- x$thr
    fdr <- x$fdr
    k <- x$sigpath
    if (length(k) == 0) {
        stop("no p-value is below threshold")
    }
    resampval <- length(x[[2]][-length(x[[2]])])
    rml <- list()
    tprx <- fprx <- fdrx <- list()
    tpx <- k
    tnx <- setdiff(rownames(tp), k)
    for (i in 1:resampval) {
        p <- x[[2]][[i]]
        p <- apply(p, 2, function(x) p.adjust(x, method = fdr))
        ptmp <- apply(p, 2, function(x) {
            m <- rep(0, length(x))
            m[which(x <= thr)] <- 1
            m
        })
        rownames(ptmp) <- rownames(p)
        rml[[i]] <- (rowMeans(ptmp[k, ]))
        fdrtmp <- fprtmp <- tprtmp <- c()
        for (j in 1:ncol(ptmp)) {
            n1 <- rownames(ptmp[which(ptmp[, j] == 1), ])
            tprtmp <- c(tprtmp, length(intersect(tpx, n1))/length(tpx))
            fprtmp <- c(fprtmp, length(intersect(tnx, n1))/length(tnx))
            fdrtmp <- c(fdrtmp, length(intersect(tnx, n1))/length(n1))
        }
        tprx[[i]] <- tprtmp
        fprx[[i]] <- fprtmp
        fdrx[[i]] <- fdrtmp
    }
    names(tprx) <- names(fprx) <- names(fdrx) <- names(rml) <- names(xx[[2]][1:resampval])
    list(power = rml, tpr = tprx, fpr = fprx, fdr = fdrx, sigpath = k)
  }
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.