extrNumericFromMatr: Extract numeric part of matrix or data.frame

View source: R/extrNumericFromMatr.R

extrNumericFromMatrR Documentation

Extract numeric part of matrix or data.frame

Description

extrNumericFromMatr extracts numeric part of matrix or data.frame, removing remaining non-numeric elements if trimToData is set to TRUE. Note, that cropping entire lines where a (single) text element appeared may quickly reduce the overal content of the input data.

Usage

extrNumericFromMatr(dat, trimToData = TRUE, silent = FALSE, callFrom = NULL)

Arguments

dat

matrix (or data.frame) for extracting numeric parts

trimToData

(logical) default to remove (crop) lines and cols contributing to NA, non-numeric data is transfomed to NA

silent

(logical) suppress messages

callFrom

(character) allow easier tracking of message(s) produced

Value

matrix of numeric data

Examples

mat <- matrix(c(letters[1:7],14:16,LETTERS[1:6]),nrow=4,dimnames=list(1:4,letters[1:4]))
mat; extrNumericFromMatr(mat)
mat <- matrix(c(letters[1:4],1,"e",12:19,LETTERS[1:6]),nr=5,dimnames=list(11:15,letters[1:4]))
mat; extrNumericFromMatr(mat)

wrMisc documentation built on May 29, 2024, 5:44 a.m.