File: xtableMatharray.R

package info (click to toggle)
r-cran-xtable 1%3A1.8-4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 992 kB
  • sloc: sh: 19; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
### xtableMatharray object
### To deal with numeric arrays such as a variance-covariance matrix
### From a request by James Curran, 16 October 2015
xtableMatharray <- function(x, caption = NULL, label = NULL,
                            align = NULL, digits = NULL,
                            display = NULL, auto = FALSE,
                            ...) {
  class(x) <- c("xtableMatharray","matrix")
  xtbl <- xtable.matrix(x,
                        caption = caption, label = label, align = align,
                        digits = digits, display = display, auto = auto,
                        ...)
  class(xtbl) <- c("xtableMatharray","xtable","data.frame")
  return(xtbl)
}

print.xtableMatharray <- function(x,
           print.results = TRUE,
           format.args = getOption("xtable.format.args", NULL),
           scalebox = getOption("xtable.scalebox", NULL),
           comment = FALSE,
           timestamp = NULL,
           ...)
{
  class(x) <- c("xtableMatharray","data.frame")
  print.xtable(x, floating = FALSE,
               tabular.environment = 'array',
               include.rownames = FALSE, include.colnames = FALSE,
               hline.after = NULL,
               print.results = print.results,
               format.args = format.args,
               scalebox = scalebox,
               comment = comment,
               timestamp = timestamp,
               ...)
}