2017-03-26 1 views
0

Ich brauche einen Weg, um die Haupt mit dem Iterator "i" davon zu ändern, etwas wie main = "Grafico de credibilidad" + ich, dann, wenn die 6 Plots erscheinen ihre Titel ändern sich wie "Grafico de credibilidad 1" und das 1 erhöhen.r plot main, Iterator in der Hauptoption eines R-Plots

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() 
} 

Vielen Dank.

Antwort

0

können Sie verwenden 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() 
} 
+0

danken Ihnen, es so gut funktioniert. –