Skip to content

Instantly share code, notes, and snippets.

View gDanix's full-sized avatar

Daniel Trujillo Viedma gDanix

View GitHub Profile
@gDanix
gDanix / grafica_temperaturas.R
Created November 8, 2016 22:48
Código en R que genera una gráfica con el dataset NY.xls
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)
@gDanix
gDanix / Graphical_RF.r
Created December 14, 2016 17:59
Código en R problemático con la definición de 'train'
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