library(knitr)
library(ggplot2)
# Créer un exemple de données
<- data.frame(
data x = rnorm(100),
y = rnorm(100)
)
# Créer un graphique de dispersion
<- ggplot(data, aes(x = x, y = y)) +
plot geom_point() +
ggtitle("Graphique de dispersion avec ggplot2")
# Afficher le graphique
print(plot)
Vérification des Dépendances R
Introduction
Ce document est un exemple de fichier Quarto Markdown (.qmd) qui utilise R, Jupyter, et d’autres dépendances R.
library(ggplot2)
# Charger le jeu de données mtcars
data("mtcars")
# Créer un graphique de dispersion
<- ggplot(data = mtcars, aes(x = wt, y = mpg)) +
plot geom_point(aes(color = cyl), size = 3) +
labs(
title = "Relation entre le Poids et la Consommation de Carburant",
x = "Poids du Véhicule (1000 lbs)",
y = "Consommation de Carburant (mpg)",
color = "Nombre de Cylindres"
+
) theme_minimal()
# Afficher la figure
print(plot)
# Exporter la figure en PNG
ggsave("figure.png", plot = plot, width = 8, height = 6)
# Exporter la figure en PDF
ggsave("figure.pdf", plot = plot, width = 8, height = 6)