Untitled

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

1 + 1
[1] 2

You can add options to executable code like this

[1] 4

The echo: false option disables the printing of code (only output is displayed).

# install.packages("ggplot2")
library(ggplot2)
Warning: package 'ggplot2' was built under R version 4.2.2
# Datos
set.seed(5)
x <- rnorm(1000)
df <- data.frame(x)

# Histograma con densidad
ggplot(df, aes(x = x)) + 
  geom_histogram(aes(y = ..density..),
                 colour = 1, fill = "blue") +
  geom_density() 
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# Histograma con densidad
ggplot(df, aes(x = x)) + 
  geom_histogram(aes(y = ..density..),
                 colour = 1, fill = "red") +
  geom_density(lwd = 1, colour = 4,
               fill = 4, alpha = 0.25)
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

# Sample dataset
set.seed(136)
df2 <- data.frame(y = rnorm(300),
                 grupo = sample(LETTERS[1:3],
                                size = 300,
                                replace = TRUE))
# Box plot by grupo
ggplot(df2, aes(x = grupo, y = y, fill = grupo)) + 
  geom_boxplot()