Ce document est un exemple de fichier Quarto Markdown (.qmd) qui utilise R, Jupyter, et d’autres dépendances R.
library(knitr)library(ggplot2)# Créer un exemple de donnéesdata <-data.frame(x =rnorm(100),y =rnorm(100))# Créer un graphique de dispersionplot <-ggplot(data, aes(x = x, y = y)) +geom_point() +ggtitle("Graphique de dispersion avec ggplot2")# Afficher le graphiqueprint(plot)
library(ggplot2)# Charger le jeu de données mtcarsdata("mtcars")# Créer un graphique de dispersionplot <-ggplot(data = mtcars, aes(x = wt, y = mpg)) +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 figureprint(plot)
# Exporter la figure en PNGggsave("figure.png", plot = plot, width =8, height =6)# Exporter la figure en PDFggsave("figure.pdf", plot = plot, width =8, height =6)