[1] 4016
[1] 4016
```
**{r}
or {python}
**#|
** not needed in a code cell in a Jupyter notebook!
Useful code chunk options
Option | Description |
---|---|
eval |
Evaluate the code chunk. |
echo |
Include the source code in output |
output |
`Include code output results (true , false , or asis )` |
warning |
Include warnings in the output. ` |
error |
Include errors in the output (continues execution if error present). |
include |
Catch all for preventing any output (code or results) from being included. |
label |
Please make sure to label your code chunks! It helps with debugging. |
fig-cap |
caption your figure |
fig-width |
width of the figure |
fig-height |
height of the figure |
Options for all code chunks: include in yaml
(top of the document).
Option 1: Source editor: Type it out
Option 2: Visual editor: Insert
> Code cell
Option 3: Shortcuts:
echo
hides (FALSE)/shows (TRUE) code and outputs results
eval
controls whether the code is actually executed (TRUE
) or just displayed without running (FALSE
).
eval
controls whether the code is actually executed (TRUE
) or just displayed without running (FALSE
).
Insert results or (quick) calculations into running text, without additional text formatting.
Why?
Enclose the R expression using `r `
.
Code:
There are `r nrow(cars)` observations in our data.
Output:
There are 50 observations in our data.
Important
If using Visual
or Source
mode, be advised the R expression will only substitute the value held by the variable when the Quarto document is rendered. That is, the value contained within the expression only appears in the output file.
Code:
The _mean_ of **x** is `r x_mu` and
the _standard deviation_ is `r x_sd`.
Output:
The mean of x is 5.5 and the standard deviation is 3.02765.
In R