Skip to contents

Calculate Z-score

Usage

zscore(object, ...)

# S4 method for matrix
zscore(object, MARGIN = 1L)

# S4 method for numeric
zscore(object)

Arguments

object

Object.

MARGIN

integer(1-2). Dimension where the function will be applied. For a two-dimensional matrix: 1 indicates rows; 2 indicates columns; c(1, 2) indicates rows and columns.

...

Additional arguments.

Value

Numeric vector or matrix.

Note

Updated 2023-01-30.

Examples

data(matrix, package = "AcidTest")

## numeric ====
object <- matrix[1L, ]
zscore(object)
#>   sample01   sample02   sample03   sample04 
#> -1.1618950 -0.3872983  0.3872983  1.1618950 

## matrix ====
object <- matrix
zscore(matrix, MARGIN = 1L)
#>         sample01   sample02  sample03 sample04
#> gene01 -1.161895 -0.3872983 0.3872983 1.161895
#> gene02 -1.161895 -0.3872983 0.3872983 1.161895
#> gene03 -1.161895 -0.3872983 0.3872983 1.161895
#> gene04 -1.161895 -0.3872983 0.3872983 1.161895