xtable (version 1.8-4)

print.xtableMatharray: Print Math Array

Description

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

Usage

# S3 method for 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.)

Value

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

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.

See Also

xtableMatharray, print.xtable

Examples

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab