Private tools for writing R markdown documents
Motivated by StackOverflow, including my own answers
Denote that this package is made for private usage, so it might not be comfortable to use.
devtools::install_github("ygeunkim/rmdtool")
(a <- 1:3)
#> [1] 1 2 3
(A <- matrix(1:9, nrow = 3))
#> [,1] [,2] [,3]
#> [1,] 1 4 7
#> [2,] 2 5 8
#> [3,] 3 6 9
In case of vector, we can use the R object in the latex block. In
fact, we can express this as vector form.
$(`r a`)^T$
Then we can get
. Writing matrix, however, is quite annoying. If we do the
same for the matrix, we will get
. So we need to add new method for
knitr::knit_print().
library(rmdtool)
Now consider
$`r A`$
This inline print method
gives
bmatrix form of the matrix. Also,
$$`r A`$$
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.