Lets be frank, it is not fun to create TeX tables from scratch.
In R
there are a few ways to get around this task by converting a
data.frame into latex tables via
huxtable,
pixiedust and
knitr.
But many times you either don’t have or don’t want to go through a
data.frame to get to your table. {texblocks}
is an attempt to create a
natural language with simple operators to quickly create reproducible
TeX tables.
Assemble LaTeX tabular environments using simple operations.
This would enable us to create any table layout with a consistent user API.
For a rendered vingette see basics
Defining a new class of R element tb
that is the basic structure of
the language.
Let t1
and t2
be two objects of class tb.
| | |
| :-------: | :-: |
| t1 + t2
| ⬛ ⬛ |
| | |
| :-------: | :-: |
| | ⬛ |
| t1 / t2
| |
| | ⬛ |
Using this language creating a table can be broken down to cell level
t1 =(
⬛+
⬛+
⬛) / (
⬛+
⬛+
⬛)
would be translated to
1 & 2 & 3 \\
4 & 5 & 6
making their combination a natural extension
t1 + t1
would translate to
1 & 2 & 3 & 1 & 2 & 3 \\
4 & 5 & 6 & 1 & 2 & 3
Converting to tb
class
texblocks can also be converted back into
tibbles
and matrices for further data manipulation.
texblocks can also be
replicated
and used as a list with purrr
verbs and base R
*apply
functions.
For a rendered vingette see aesthetics
A set of elements can be defined to control the table and cell level attributes, eg
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.