Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

print.xtableMatharray

Print Math Array


Description

For an object of class "xtableMatharray", returns the LaTeX commands to produce an array.

Usage

## S3 method for class 'xtableMatharray'
print(x,
  print.results = TRUE,
  format.args = getOption("xtable.format.args", NULL),
  scalebox = getOption("xtable.scalebox", NULL),
  comment = FALSE,
  timestamp = NULL,
  ...)

Arguments

x

An object of class "xtableMatharray".

print.results

If TRUE, the generated table is printed to standard output. Set this to FALSE if you will just be using the character vector that is returned invisibly. Default value is TRUE.

format.args

List of arguments for the formatC function. For example, standard German number separators can be specified as format.args=list(big.mark = "'", decimal.mark = ","). The arguments digits and format should not be included in this list. See details for function print.xtable. Default value is NULL.

scalebox

If not NULL, a scalebox clause will be added around the tabular environment with the specified value used as the scaling factor. Default value is NULL.

comment

If TRUE, the version and timestamp comment is included. Default value is FALSE.

timestamp

Timestamp to include in LaTeX comment. Set this to NULL to exclude the timestamp. Default value is NULL.

...

Additional arguments. (Currently ignored.)

Details

This command prints an array of numbers which may be included in a mathematical expression in a LaTeX document created using Sweave or knitr. Internally it calls print.data.frame but with special values for the arguments, namely that the tabular environment is array, row names and column names are not included, and there are no horizontal lines. Note that the default values for the arguments comment and timestamp are different to the default values for print.xtable, the justification being that comments would make the resulting LaTeX harder to read.

Value

A character vector containing the LaTeX code for incorporating an array in a mathematical expression.

Author(s)

See Also

Examples

V <- matrix(c(1.140380e-03,  3.010497e-05,  7.334879e-05,
              3.010497e-05,  3.320683e-04, -5.284854e-05,
              7.334879e-05, -5.284854e-05,  3.520928e-04), nrow = 3)
### Simple test of print.xtableMatharray
print.xtableMatharray(xtable(V, display = rep("E", 4)))

class(V) <- c("xtableMatharray")
class(V)

### Test without any additional arguments
mth <- xtableMatharray(V)
str(mth)
print(mth)

### Test with arguments to xtable
mth <- xtableMatharray(V, display = rep("E", 4))
str(mth)
print(mth)

mth <- xtableMatharray(V, digits = 6)
str(mth)
print(mth)

### Test with additional print.xtableMatharray arguments
mth <- xtableMatharray(V, digits = 6)
str(mth)
print(mth, format.args = list(decimal.mark = ","))
print(mth, scalebox = 0.5)
print(mth, comment = TRUE)
print(mth, timestamp = "2000-01-01")
print(mth, comment = TRUE, timestamp = "2000-01-01")

xtable

Export Tables to LaTeX or HTML

v1.8-4
GPL (>= 2)
Authors
David B. Dahl [aut], David Scott [aut, cre], Charles Roosen [aut], Arni Magnusson [aut], Jonathan Swinton [aut], Ajay Shah [ctb], Arne Henningsen [ctb], Benno Puetz [ctb], Bernhard Pfaff [ctb], Claudio Agostinelli [ctb], Claudius Loehnert [ctb], David Mitchell [ctb], David Whiting [ctb], Fernando da Rosa [ctb], Guido Gay [ctb], Guido Schulz [ctb], Ian Fellows [ctb], Jeff Laake [ctb], John Walker [ctb], Jun Yan [ctb], Liviu Andronic [ctb], Markus Loecher [ctb], Martin Gubri [ctb], Matthieu Stigler [ctb], Robert Castelo [ctb], Seth Falcon [ctb], Stefan Edwards [ctb], Sven Garbade [ctb], Uwe Ligges [ctb]
Initial release
2019-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.