Learn R Programming

tableParser (version 1.0.2)

unifyMatrixContent: unifyMatrixContent

Description

Unifies textual and numerical content of character matrices. Unifies hyphens, spaces, hexadecimal and Greek letters, and performs space and comma corrections. Big marks in numbers are removed. HTML tags <sup> and <sub> are converted to '^' and '_' respectively. All other HTML tags are removed.

Usage

unifyMatrixContent(
  x,
  letter.convert = TRUE,
  greek2text = TRUE,
  text2num = TRUE,
  correctComma = FALSE,
  na.rm = TRUE
)

Value

A unified character matrix or list of character matrices.

Arguments

x

A character matrix or list of character matrices.

letter.convert

Logical. If TRUE, hexadecimal- and html-encoded letters will be unified and converted to Unicode with JATSdecoder::letter.convert().

greek2text

Logical. If TRUE and 'letter.convert=TRUE', converts and unifies various Greek letters to a text-based form (e.g., 'alpha', 'beta').

text2num

Logical. If TRUE, textual representations of numbers (words, exponents, fractions) are converted to digit numbers.

correctComma

Logical. If TRUE, commas used as numeric separators are converted to dots.

na.rm

Logical. If TRUE, cells with NA, or only minus, hyphen, slash, or dot are set to empty cells.

Examples

Run this code
# Example matrix
m<-rbind(c("","ß","Standard Error","Pr(>|t|)"),
         c("(Intercept)","1,234.5","123.4","1.3e-4"),
         c("Variable 1","1,2",".04","2.4*10^-5"),
         c("R^2",".23","*","-"))
m

# apply function
unifyMatrixContent(m, correctComma = TRUE)

Run the code above in your browser using DataLab