Charalampos A. Lazaris 2024-02-18
This is a Quarto tutorial based on the official Posit cheatsheet. It features some of the new features in Quarto v. 1.4.
Let’s insert some inline code in R: 2 gives 2
Here is some R
code:
Code
p <- 1 + 1
print(p)
[1] 2
Now, let’s import some data and create a graph, after loading the required libraries:
Code
library(tidyverse)
Code
data(iris)
glimpse(iris)
Rows: 150
Columns: 5
$ Sepal.Length <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5.4, 4.…
$ Sepal.Width <dbl> 3.5, 3.0, 3.2, 3.1, 3.6, 3.9, 3.4, 3.4, 2.9, 3.1, 3.7, 3.…
$ Petal.Length <dbl> 1.4, 1.4, 1.3, 1.5, 1.4, 1.7, 1.4, 1.5, 1.4, 1.5, 1.5, 1.…
$ Petal.Width <dbl> 0.2, 0.2, 0.2, 0.2, 0.2, 0.4, 0.3, 0.2, 0.2, 0.1, 0.2, 0.…
$ Species <fct> setosa, setosa, setosa, setosa, setosa, setosa, setosa, s…
We now plot Petal.Length
vs. Petal.Width
:
Code
#| fig-cap: "Petal length vs. petal width in iris species"
ggplot(data = iris, aes(x = Petal.Width, y = Petal.Length)) +
geom_point() +
geom_smooth(method = "lm", se = TRUE) +
ggtitle("Petal length vs. petal width") +
xlab("Petal width") + ylab("Petal length") +
theme_bw()
`geom_smooth()` using formula = 'y ~ x'
Here is some bold text and here is some text in italics. We can
also text or strikethrough text: hello. We can also create
some lists. Let’s start with a numbered list:
- First
- Second
- Third
Now, let’s make the same list, nested:
- First
- Hello
- Hi
- Ciao
- Second
- Third
We can also have unordered lists:
- First
- Hello
- Hi
- Ciao
- 1
- Second
- Third
We can also insert links to URLs: my website or links to pictures. Here is a photo of my favorite writer:
We can also insert tables:
ID | Name | Surname |
---|---|---|
1 | James | Dean |
2 | Marlon | Brando |
3 | Montgomery | Cliff |