I need a way to change the main with the iterator "i" of that for, something like main = "Grafico de credibilidad" + i, then when the 6 plots appear their titles change like "Grafico de credibilidad 1" and that 1 increase.
momentos1 <- read.table("momentos1.txt")
par(mfrow = c(2,3),bg = "white")
x<-seq(0,1,0.01)
for(i in 1:6){
plot(x,dbeta(x,momentos1$alpha.1.30.[i],momentos1$beta.1.30.[i]),
main = "Grafico Credibilidad",axes = F,col="blue",
ylab = "",
xlab = "",
ylim = c(0,5),type = "l"
)
axis(1,at = seq(0,1,0.1),las=1)
box()
grid()
}
Thanks a lot.
You can use paste()
momentos1 <- read.table("momentos1.txt")
par(mfrow = c(2,3),bg = "white")
x<-seq(0,1,0.01)
for(i in 1:6){
plot(x,dbeta(x,momentos1$alpha.1.30.[i],momentos1$beta.1.30.[i]),
main = paste("Grafico Credibilidad ",i),axes = F,col="blue",
ylab = "",
xlab = "",
ylim = c(0,5),type = "l"
)
axis(1,at = seq(0,1,0.1),las=1)
box()
grid()
}