signifNumeric: Round numeric columns to given significant digits.

View source: R/Functions.R

signifNumericR Documentation

Round numeric columns to given significant digits.

Description

This function applies link{signif} (or possibly other rounding function) to numeric, non-integer columns of a given data frame.

Usage

signifNumeric(x, digits, fnc = "signif")

Arguments

x

Input data frame, matrix or matrix-like object that can be coerced to a data frame.

digits

Significant digits to retain.

fnc

The rounding function. Typically either signif or round.

Details

The function fnc is applied to each numeric column that contains at least one non-integer (i.e., at least one element that does not equal its own round).

Value

The transformed data frame.

Author(s)

Peter Langfelder

See Also

The rounding functions signif and round.

Examples

  df = data.frame(text = letters[1:3], ints = c(1:3)+234, nonints = c(0:2) + 0.02345);
  df;
  signifNumeric(df, 2);
  signifNumeric(df, 2, fnc = "round");

WGCNA documentation built on Jan. 22, 2023, 1:34 a.m.

Related to signifNumeric in WGCNA...