]> git.donarmstrong.com Git - xtable.git/blob - pkg/R/toLatex.R
Added "toLatex()" method. Added "print.result" argument to "print.xtable()" function.
[xtable.git] / pkg / R / toLatex.R
1 ### xtable package\r
2 ###\r
3 ### Produce LaTeX and HTML tables from R objects.\r
4 ###\r
5 ### Copyright 2000-2012 David B. Dahl <dahl@stat.tamu.edu>\r
6 ###\r
7 ### Maintained by Charles Roosen <croosen@mango-solutions.com>\r
8 ###\r
9 ### This file is part of the `xtable' library for R and related languages.\r
10 ### It is made available under the terms of the GNU General Public\r
11 ### License, version 2, or at your option, any later version,\r
12 ### incorporated herein by reference.\r
13 ###\r
14 ### This program is distributed in the hope that it will be\r
15 ### useful, but WITHOUT ANY WARRANTY; without even the implied\r
16 ### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
17 ### PURPOSE.  See the GNU General Public License for more\r
18 ### details.\r
19 ###\r
20 ### You should have received a copy of the GNU General Public\r
21 ### License along with this program; if not, write to the Free\r
22 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,\r
23 ### MA 02111-1307, USA\r
24 \r
25 ## The generic for toLatex() is declared in the base package "utils"\r
26 \r
27 toLatex.xtable <- function(object, ...){\r
28   # Initially just capturing the output of print.xtable().  At some\r
29   # point this could be refactored to have print.xtable() call\r
30   # toLatex() instead. - CR, 30/01/2012\r
31   dotArgs <- list(...)\r
32   dotArgs$x <- object\r
33   dotArgs$type <- "latex"\r
34   dotArgs$print.result <- FALSE\r
35   z <- do.call("print.xtable", dotArgs)\r
36 \r
37   z <- strsplit(z, split="\n")[[1]]\r
38   class(z) <- "Latex"\r
39   z\r
40 }\r