This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library (randomForest) | |
acierto <- function(bag.datos){ | |
return (sum (sapply(1:length(bag.datos$y), function(x){ | |
if (is.na(bag.datos$predicted[x])){ | |
0 | |
} | |
else if (as.numeric(bag.datos$y[x])==as.numeric(bag.datos$predicted[x])){ | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lowest_y = min(min(ny$`Warmest Minimum Temperature (C)`), min(ny$`Coldest Minimum Temperature (C)`)) | |
highest_y = max(max(ny$`Warmest Minimum Temperature (C)`), max(ny$`Coldest Minimum Temperature (C)`)) | |
plot(ny$Year, ny$`Warmest Minimum Temperature (C)`, xlim = c(min(ny$Year), 2015), xlab = "Año", ylab = "Temperatura (ºC)", main = "Temperaturas mínimas más cálidas y frías", xaxt = "n", type = "l", ylim = c(lowest_y, highest_y), col="orange") | |
lines(ny$Year, ny$`Coldest Minimum Temperature (C)`, xlim = c(min(ny$Year), 2015), type = "l", ylim = c(lowest_y, highest_y), col="cadetblue3") | |
axis(1, at=seq(1900,2015, 5), cex.axis = 0.5) | |
abline(h=seq(-10,15,2.5), lty=2) | |
legend("topleft", legend="Más cálida", col="orange", lty=1, cex=0.6) | |
legend("bottomleft", legend="Más fría", col="cadetblue3", lty=1, cex=0.6) |