Description Usage Arguments Value Creation notes Examples
Creates a matrix formated for latex with brackets in Rmarkdown.
Needs to be inserted "asis" inside of an existing formula by surrounding the
code chunk in `$$`
signs or having this built into the output of the
code chunk (see Examples).
1 | adaptiveInlineMatrix(mat)
|
mat |
numeric matrix. |
Returns the plain text latex code needed to create the formatted matrix.
First created on 2019-Jul-10 as I was working on STAT 512 homework.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # Data
```{r}
Q1n <- 6
Q1Y <- matrix(c(1,2,4,3,3,2), ncol = 1)
Q1X0 <- rep(1,Q1n)
Q1X1 <- c(1,1,2,3,2,2)
Q1X2 <- c(2,3,6,3,2,4)
Q1X <- cbind(Q1X0, Q1X1, Q1X2)
```
### FIRST OPTION (Better when you need to make multiple matrices in equation)
# Start math formula outside chunck
$$\mathbf{X} =
# First matrix
```{r echo=FALSE, results='asis'}
cat(adaptiveInlineMatrix(Q1X))
```
*
# Second matrix
```{r echo=FALSE, results='asis'}
cat(adaptiveInlineMatrix(Q1Y))
```
# End math formula
$$
### SECOND OPTION
# Define it all in one chuck (have to remember to do extra escape characters)
```{r echo=FALSE, results='asis'}
cat(paste0("$\mathbf{X} = ", adaptiveInlineMatrix(Q1X)), "$")
```
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.