Skip to contents

Scale the data using any custom function, provided it returns a matrix of the same dimensions as the input matrix.

Usage

function_scale_region(
  region,
  to = "NormalizedData",
  from = "Data",
  MARGIN = 1,
  f,
  ...
)

Arguments

region

A Region object, or concatenated data generated by .smapply.

to

Which data slot to assign the normalized data to.

from

Which data slot to pull data from.

MARGIN

Whether to apply the function within each biomarker (1) or across all biomarkers in each cell (2). If f doesn't need to work with apply, can pass MARGIN = NULL.

f

A function. This function must take a numeric matrix as its first argument--when applied by function_scale, this will be the matrix of biomarker expressions. If MARGIN is 1 or 2, f can instead take a numeric vector, and f will be apply'd across the specified margin. Additional arguments may be passed via the dots.

...

Additional arguments passed to f.

Value

An updated Region object with normalized data added to the slot specified in to

See also

Scroll to top