This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document 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:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.
if(!require(VennDiagram)) install.packages(“VennDiagram”)
if(!require(VennDiagram)) install.packages("VennDiagram")
## Loading required package: VennDiagram
## Loading required package: grid
## Loading required package: futile.logger
library(VennDiagram)
library(grid)
# Configuración de colores
color_A <- "#FF6B6B" # Rojo pastel
color_B <- "#4ECDC4" # Turquesa
color_union <- "#FFE66D" # Amarillo para resaltar
color_texto <- "#333333"
# Crear diagrama
grid.newpage()
venn_union <- draw.pairwise.venn(
area1 = 40, area2 = 30, cross.area = 20,
category = c("A", "B"),
fill = c(color_A, color_B),
alpha = c(0.7, 0.7),
col = c("black", "black"),
label.col = c(color_texto, color_texto, color_texto),
cex = 1.8,
cat.cex = 1.5,
cat.col = c(color_texto, color_texto)
)
# Resaltar la unión
grid.text("Unión: A ∪ B", x = 0.5, y = 0.95, gp = gpar(fontsize = 16, fontface = "bold"))
# Leyenda
grid.text("Área total coloreada: Unión (A ∪ B)",
x = 0.5, y = 0.1,
gp = gpar(fontsize = 12, col = color_texto, fontface = "bold"))
grid.draw(venn_union)