r plot main,在R plot的主要选项中的迭代器

问题描述:

我需要一种方法来改变main的迭代器“i”,例如main =“Grafico de credibilidad”+ i,然后当6情节出现他们的标题变化像“Grafico de credibilidad 1”,并且1增加。r plot main,在R plot的主要选项中的迭代器

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

非常感谢。

您可以使用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

谢谢你,它的工作这么好。 –