This is an R HTML document. When you click the Knit HTML button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist ## Min. : 4.0 Min. : 2.00 ## 1st Qu.:12.0 1st Qu.: 26.00 ## Median :15.0 Median : 36.00 ## Mean :15.4 Mean : 42.98 ## 3rd Qu.:19.0 3rd Qu.: 56.00 ## Max. :25.0 Max. :120.00
You can also embed plots, for example:
plot(cars) library(ggplot2)
boxplot_mpg_cyl <- ggplot(mtcars, aes(x=factor(cyl), y=mpg)) + geom_boxplot(fill="green", color="black", alpha=0.7) + labs(title="Boxplot del Consumo de Gasolina (mpg) por Número de Cilindros", x="Número de Cilindros", y="Millas por galón (mpg)") + theme_minimal() print(boxplot_mpg_cyl)
# Histograma del consumo de gasolina (mpg) histograma_mpg <- ggplot(mtcars, aes(x=mpg)) + geom_histogram(binwidth=2, fill="blue", color="black", alpha=0.7) + labs(title="Histograma del Consumo de Gasolina (mpg)", x="Millas por galón (mpg)", y="Frecuencia") + theme_minimal() print(histograma_mpg)
# Gráfico de dispersión entre el peso (wt) y el consumo de gasolina (mpg) dispersion_wt_mpg <- ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point(color="red", size=3) + labs(title="Gráfico de Dispersión: Peso vs. Consumo de Gasolina", x="Peso (1000 lbs)", y="Millas por galón (mpg)") + theme_minimal() print(dispersion_wt_mpg)