diff --git a/R/RcppExports.R b/R/RcppExports.R index 2a320be..022bb7b 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -24,6 +24,10 @@ cossimVec <- function(x, y, narm) { #' \item{5 (AMEAN RULE) Arithmetic mean of length of intersect divided by length of \emph{both} seeds no less than \code{multiLinkageThr}, a few items tend to appear in multiple clusters.} #' } #' +#' @return A list of integer vectors. Each element represents a cluster +#' and contains the indices of rows belonging to that cluster. Rows can +#' appear in multiple clusters (fuzzy clustering). +#' #' @author Jitao David Zhang #' #' @note diff --git a/R/davidClustering_kappa_R.R b/R/davidClustering_kappa_R.R index 9b048b6..1369b17 100644 --- a/R/davidClustering_kappa_R.R +++ b/R/davidClustering_kappa_R.R @@ -19,18 +19,6 @@ #' biological module-centric algorithm to functionally analyze large gene #' lists. Genome Biology, 2007. \doi{10.1186/gb-2007-8-9-r183} #' -#' @examples -#' synData <- matrix(c(rep(c(rep(1, 10), rep(0, 5)), 3), -#' rep(0, 4), rep(1, 7), rep(0,4), -#' rep(c(rep(0,5), rep(1,10)), 3), -#' rep(c(rep(0,3), 1), 4)[-16]), ncol=15, byrow=TRUE) -#' rownames(synData) <- sprintf("Gene %s", letters[1:8]) -#' colnames(synData) <- sprintf("t%d", 1:15) -#' synRowKappa <- rowKappa(synData) -#' synColKappa <- colKappa(synData) -#' ribiosMath:::davidClustering_kappa_R(synRowKappa, removeRedundant = TRUE, debug=FALSE) -#' ribiosMath:::davidClustering_kappa_R(synColKappa, removeRedundant = TRUE, debug=FALSE) -#' davidClustering_kappa_R <- function(kappaMatrix, kappaThr = 0.35, initialGroupMembership=3, diff --git a/R/kappa.R b/R/kappa.R index f0ce61f..cbba02d 100644 --- a/R/kappa.R +++ b/R/kappa.R @@ -9,9 +9,6 @@ #' @family kappa functions #' @seealso \code{\link{colKappa}} to calculate the same statistic using a linear algebra based routine #' -#' @examples -#' testMat <- cbind(c(1,1,0,0,1,0), c(1,1,0,1,1,0)) -#' ribiosMath:::kappaSimp(testMat) kappaSimp <- function(matrix, minOverlap=0) { res <- .Call('_ribiosMath_colKappaSimp', matrix, minOverlap) return(res) diff --git a/R/pca.R b/R/pca.R index c10f2b3..e8b9742 100644 --- a/R/pca.R +++ b/R/pca.R @@ -115,9 +115,11 @@ biplot.bidata <- function(bidata, } else { points(x, cex=cex[1L], col=col[1L],...) } + oldpar <- par(no.readonly = TRUE) + on.exit(par(oldpar)) par(new = TRUE) dev.hold() - on.exit(dev.flush()) + on.exit(dev.flush(), add = TRUE) plot(y, axes = FALSE, type = "n", xlim = xlim * ratio, ylim = ylim * ratio, xlab = "", ylab = "", col = col[1L], ...) diff --git a/R/simulate_from_density.R b/R/simulate_from_density.R index 860bd6d..2c67132 100644 --- a/R/simulate_from_density.R +++ b/R/simulate_from_density.R @@ -5,6 +5,8 @@ #' can be aproximated using a gaussian kernel. #' @param vec Numeric vector #' @param N Integer, number of simulated instances +#' @return A numeric vector of length \code{N} with values simulated from the +#' kernel density estimate of \code{vec}. #' @author Iakov Davydov #' @examples #' my_vec <- c(23, 27, 26, 24, 25) diff --git a/R/tfidf.R b/R/tfidf.R index f0e9264..0e0f287 100644 --- a/R/tfidf.R +++ b/R/tfidf.R @@ -4,6 +4,9 @@ #' @param idfVariant Variant of inverse document frequency. See details below. #' @param idfAddOne Logical, whether one should be added to both numerator and denominator to calculate IDF. See details below. #' +#' @return A numeric matrix of the same dimensions as \code{tdMat}, containing +#' the TF-IDF values. +#' #' @details #' \code{tfVariant} accepts following options: #' \describe{ diff --git a/man/davidClustering_kappa.Rd b/man/davidClustering_kappa.Rd index 7947a5a..ea361ba 100644 --- a/man/davidClustering_kappa.Rd +++ b/man/davidClustering_kappa.Rd @@ -32,6 +32,11 @@ Currently following merge rules are implemented: \item{5 (AMEAN RULE) Arithmetic mean of length of intersect divided by length of \emph{both} seeds no less than \code{multiLinkageThr}, a few items tend to appear in multiple clusters.} }} } +\value{ +A list of integer vectors. Each element represents a cluster +and contains the indices of rows belonging to that cluster. Rows can +appear in multiple clusters (fuzzy clustering). +} \description{ The function implements the Hierarhical fuzzy multi-linkage partitioning method used in the DAVID Bioinformatics tool. } diff --git a/man/davidClustering_kappa_R.Rd b/man/davidClustering_kappa_R.Rd index 61fc6cb..b61a4cd 100644 --- a/man/davidClustering_kappa_R.Rd +++ b/man/davidClustering_kappa_R.Rd @@ -31,19 +31,6 @@ The function implements the Hierarhical fuzzy multi-linkage partitioning method } \note{ The function has only been tested in a few anecdotal examples. Cautions and more systematic tests are required before it is applied to critical datasets. -} -\examples{ -synData <- matrix(c(rep(c(rep(1, 10), rep(0, 5)), 3), -rep(0, 4), rep(1, 7), rep(0,4), -rep(c(rep(0,5), rep(1,10)), 3), -rep(c(rep(0,3), 1), 4)[-16]), ncol=15, byrow=TRUE) -rownames(synData) <- sprintf("Gene \%s", letters[1:8]) -colnames(synData) <- sprintf("t\%d", 1:15) -synRowKappa <- rowKappa(synData) -synColKappa <- colKappa(synData) -ribiosMath:::davidClustering_kappa_R(synRowKappa, removeRedundant = TRUE, debug=FALSE) -ribiosMath:::davidClustering_kappa_R(synColKappa, removeRedundant = TRUE, debug=FALSE) - } \references{ Huang et al. The DAVID Gene Functional Classification Tool: a novel diff --git a/man/kappaSimp.Rd b/man/kappaSimp.Rd index 14cca93..83b7f96 100644 --- a/man/kappaSimp.Rd +++ b/man/kappaSimp.Rd @@ -17,10 +17,6 @@ A matrix of size nxn if the input matrix is of size mxn (m is arbitrary) \description{ Calculate column-wise kappa statistics of a matrix, using a simple procedure by going through the matrix and counting } -\examples{ -testMat <- cbind(c(1,1,0,0,1,0), c(1,1,0,1,1,0)) -ribiosMath:::kappaSimp(testMat) -} \seealso{ \code{\link{colKappa}} to calculate the same statistic using a linear algebra based routine diff --git a/man/simulate_from_density.Rd b/man/simulate_from_density.Rd index 6606ba2..5d56e5c 100644 --- a/man/simulate_from_density.Rd +++ b/man/simulate_from_density.Rd @@ -11,6 +11,10 @@ simulate_from_density(vec, N = 1e+05) \item{N}{Integer, number of simulated instances} } +\value{ +A numeric vector of length \code{N} with values simulated from the +kernel density estimate of \code{vec}. +} \description{ Compared with bootstrapping, the results do not reveal input values, and the empirical distribution can be smoother. The function assumes that the distribution diff --git a/man/tfidf.Rd b/man/tfidf.Rd index 5173cf7..3f7f76c 100644 --- a/man/tfidf.Rd +++ b/man/tfidf.Rd @@ -20,6 +20,10 @@ tfidf( \item{idfAddOne}{Logical, whether one should be added to both numerator and denominator to calculate IDF. See details below.} } +\value{ +A numeric matrix of the same dimensions as \code{tdMat}, containing +the TF-IDF values. +} \description{ Calculate TF-IDF using a input matrix with terms in rows and documents in columns }