latexODBCTable: Retrieve database table and format it nicely for LaTeX

Description Usage Arguments Value Note Author(s) See Also Examples

Description

Generates LaTeX table from data retrieved from an Excel or Access file. The table is closed immediately after retrieval.

Usage

1
2
3
4
latexODBCTable(object, title = "", table = NULL, caption = NULL,
  longtable = FALSE, ctable = FALSE, label = NULL, file = "",
  sql = paste("select * from", table), where = "!htbp", mincapwidth = 120,
  width, as.is = FALSE, ...)

Arguments

object

path of Excel or Access file. Currently, no other ODBC source are supported, but changing this should be easy.

title

to be printed in upper left corner

table

name of table or query in database, or named range in Excel. In theory, giving worksheet names for Excel should work, but results are mixed, so better always use named ranges. Not used if sql is given.

caption

optional caption. Default is Table <tablename>, n=<number of rows>

longtable

use longtable; cannot be combinded with ctable

ctable

Uses ctable-formatting of LaTeX by default.

label

optional label. Default is tab:tablename

file

output file name; default prints output to the standard output, which is the choice for Sweave.

sql

SQL query to retrieve data. Default is whole table. Parameter table is not used if query is given.

where

positioning parameter for LaTeX

mincapwidth

for ctable, the minimum caption width in mm. Requires ctable1.sty or a more recent update of ctable.

width

for ctable, width of table. Should be given when column type X is used.

as.is

passed to sqlQuery; if true, string are not converted to factors.

...

Additional parameters passed to latex in Hmisc.

Value

Returns the table retrieved from the database. This is somewhat inconsistent to latex.lme and friends that return the latex object, but it's convenient if single items of the table are to be displayed in Sweave.

Note

Requires ctable in your Snw/tex file if ctable = TRUE

Author(s)

Dieter Menne, dieter.menne@menne-biomed.de

See Also

lme.value, latex, latex.lme, lme

Examples

1
2
3
4
5
6
7
8
## Not run: 
   # tex output in Sweave
   database = system.file("extdata", "testtable.accdb", package = "Dlatex")
   tb <- latexODBCTable(database, table = "Subject")



## End(Not run)

dmenne/dlatex documentation built on May 15, 2019, 9:32 a.m.