knitr::opts_chunk$set(echo = TRUE)
options(repos = c(CRAN = "https://cloud.r-project.org/"))
data(trees)
Arboles <- subset(trees, Height >= 70 & Height <= 80 & Girth < 13)
head(Arboles)
## Girth Height Volume
## 1 8.3 70 10.3
## 4 10.5 72 16.4
## 8 11.0 75 18.2
## 9 11.1 80 22.6
## 10 11.2 75 19.9
## 11 11.3 79 24.2
library(tree)
colors <- ifelse(trees$Height >= 70 & trees$Height <= 80 & trees$Girth < 13, "green", "black")
plot(trees$Girth, trees$Height,
col = colors,
pch = 22,
xlab = "Diámetro (pulgadas)",
ylab = "Altura (pies)",
main = "Altura y Ancho de Árboles Cherry Negros")
legend("topright", legend = c("Filtrados", "No Filtrados"), col = c("green", "black"), pch = 22, title = "Diámetro vs Altura")
