Displayed equations

\[ \begin{eqnarray} T = \left\{\begin{array}{ll} \overline{X} & \mbox{ with probability } 1 - 1/n \,, \\ \overline{X} + n & \mbox{ with probability } 1/n \,. \\ \end{array}\right. \end{eqnarray} \]

\[ \begin{aligned} P(X \leq x) &= P(F^{-1}(U) \leq x) \\ &= P(F(F^{-1}(U)) \leq F(x)) \\ &= P(U \leq F(x)) = F(x). \end{aligned} \]

Tips (prompted by issues when creating Word output):

R-generated figure

plot(1:10, 1:10, pch = 1:10, xlab = "x", ylab = "y")
Alt text.

Use knitr chunk options fig.alt (alternative text) and fig.cap (caption).

External figure (png file)

include_graphics(system.file(package = "accessr", "examples", "plot.png"))
Alt text.

Use knitr::include_graphics().

Table

The table will only appear if both of the packages dplyr or huxtable are installed. The huxtable code is hidden because it is lengthy. Of course, there are many other ways to create tables in R markdown.

Table caption
clinicdrugsuccess (S)failure (F)
1A3624
B2416
2A416
B1664

Hiding stuff using echo

Setting params$hide = TRUE can be used to hide content

Hiding a figure using eval

The figure is missing because params$hide = TRUE

plot(1:10, 1:10, pch = 1:10, xlab = "x", ylab = "y")