simplifyMatrix: Simplify matrix in case of single row/columns

Description Usage Arguments Examples

View source: R/utils.R

Description

Simplify matrix in case of single row/columns

Usage

1

Arguments

matrix

A matrix of any dimension

If only one row/column is present, the dimension is dropped and a vector will be returned

Examples

1
2
3
4
testMatrix <- matrix(round(rnorm(9),2), nrow=3)
simplifyMatrix(testMatrix)
simplifyMatrix(testMatrix[1L,,drop=FALSE])
simplifyMatrix(testMatrix[,1L,drop=FALSE])

Example output

Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

      [,1]  [,2] [,3]
[1,] -1.05 -0.31 1.10
[2,]  0.61 -0.27 0.70
[3,]  1.43 -0.90 0.15
[1] -1.05 -0.31  1.10
[1] -1.05  0.61  1.43

BioQC documentation built on Nov. 8, 2020, 7:16 p.m.