import_kable {gretlR} | R Documentation |
Import file as kable
in R Markdown or Quarto document.
Description
Use this function to import file as kable
in R Markdown or Quarto document.
Usage
import_kable(path=".",chunk="",file="",start=NA,end=NA,skip_blank=TRUE,
format=kable_format(),digits = getOption("digits"), row.names = NA,col.names = NA, align,
caption = NULL,
label = NULL, format.args = list(),escape = FALSE, table.attr = "", booktabs = TRUE,
longtable = FALSE, valign = "t",position = "h", centering = TRUE,
vline = getOption("knitr.table.vline",if (booktabs) "" else "|"),
toprule = getOption("knitr.table.toprule",
if (booktabs) "\\toprule" else "\\hline"),
bottomrule = getOption("knitr.table.bottomrule",
if (booktabs) "\\bottomrule" else "\\hline"),
midrule = getOption("knitr.table.midrule",
if (booktabs) "\\midrule" else "\\hline"),
linesep = if (booktabs) c("","", "", "", "\\addlinespace") else "\\hline",
caption.short = "",table.envir = if (!is.null(caption)) "table",...)
Arguments
path |
Object or a character string representing the path(s) to the |
chunk |
Name of the |
file |
Name of a file to be imported as |
start |
Numeric. The start line of the |
end |
Numeric. The last line of the |
skip_blank |
Logical. Whether or not to include blank rows. |
format |
A character string. Possible values are |
digits |
Maximum number of digits for numeric columns, passed to
|
row.names |
Logical: whether to include row names. By default, row names
are included if |
col.names |
A character vector of column names to be used in the table. |
align |
Column alignment: a character vector consisting of |
caption |
The table caption. |
label |
The table reference label. By default, the label is obtained
from |
format.args |
A list of arguments to be passed to |
escape |
Boolean; whether to escape special characters when producing
HTML or LaTeX tables. When |
table.attr |
A character string for addition HTML table attributes. This is convenient if you simply want to add a few HTML classes or styles. For example, you can put 'class="table" style="color: red"'. |
booktabs |
T/F for whether to enable the booktabs format for tables. I personally would recommend you turn this on for every latex table except some special cases. |
longtable |
T/F for whether to use the longtable format. If you have a table that will span over two or more pages, you will have to turn this on. |
valign |
You probably won't need to adjust this latex option very often.
If you are familar with latex tables, this is the optional position for the
tabular environment controling the vertical position of the table relative
to the baseline of the surrounding text. Possible choices are |
position |
This is the "real" or say floating position for the latex
table environment. The |
centering |
T (default)/F. Whether to center tables in the table environment. |
vline |
vertical separator. Default is nothing for booktabs tables but "|" for normal tables. |
toprule |
toprule. Default is hline for normal table but toprule for booktabs tables. |
bottomrule |
bottomrule. Default is hline for normal table but bottomrule for booktabs tables. |
midrule |
midrule. Default is hline for normal table but midrule for booktabs tables. |
linesep |
By default, in booktabs tables, |
caption.short |
Another latex feature. Short captions for tables |
table.envir |
You probably don't need to change this as well. The default setting is to put a table environment outside of tabular if a caption is provided. |
... |
Other arguments (see Examples and References). |
Value
kable
See Also
Other important functions:
eng_gretl()
,
exec_gretl()
,
exec_inp()
,
gretlR
,
include_graph()
,
include_tex()
,
write_inp()
Examples
library(gretlR)
## Not run:
code=r'(nulldata 500
set seed 13
gretl1 = normal()
gretl2 = normal()
setobs 12 1980:01 --time-series
ols gretl1 const gretl2
tabprint --output="olsTable.csv")'
exec_gretl(code=code,path='gretlR/Table/gretlCode') # this creates 'gretlR/Table' folder
import_kable(chunk = "Table",file = "olsTable.csv",format="pandoc",caption="Table generated
from gretl chunk", start=3,end=7,digits=2)
# Alternatively, use the absolute/relative path to the file
import_kable(path = "gretlR/Table/olsTable.csv",format="pandoc",caption="Table generated
from path", start=3,end=7,digits=2)
## End(Not run)