File: toLatex.R

package info (click to toggle)
r-cran-xtable 1%3A1.7-4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 612 kB
  • sloc: sh: 19; makefile: 1
file content (40 lines) | stat: -rw-r--r-- 1,458 bytes parent folder | download
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
37
38
39
40
### xtable package
###
### Produce LaTeX and HTML tables from R objects.
###
### Copyright 2000-2013 David B. Dahl <dahl@stat.byu.edu>
###
### Maintained by Charles Roosen <croosen@mango-solutions.com>
###
### This file is part of the `xtable' library for R and related languages.
### It is made available under the terms of the GNU General Public
### License, version 2, or at your option, any later version,
### incorporated herein by reference.
###
### This program is distributed in the hope that it will be
### useful, but WITHOUT ANY WARRANTY; without even the implied
### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
### PURPOSE.  See the GNU General Public License for more
### details.
###
### You should have received a copy of the GNU General Public
### License along with this program; if not, write to the Free
### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
### MA 02111-1307, USA

## The generic for toLatex() is declared in the base package "utils"

toLatex.xtable <- function(object, ...){
  # Initially just capturing the output of print.xtable().  At some
  # point this could be refactored to have print.xtable() call
  # toLatex() instead. - CR, 30/01/2012
  dotArgs <- list(...)
  dotArgs$x <- object
  dotArgs$type <- "latex"
  dotArgs$print.results <- FALSE
  z <- do.call("print.xtable", dotArgs)

  z <- strsplit(z, split="\n")[[1]]
  class(z) <- "Latex"
  z
}