Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 为()绘制()时出错_R_Function_For Loop_Plot - Fatal编程技术网

R 为()绘制()时出错

R 为()绘制()时出错,r,function,for-loop,plot,R,Function,For Loop,Plot,在for()中使用plot()时出错 (我试图通过使用for()进行重复来减少工作量) >head(data.6times[3:7])#data.6times有40列 cyear ccode scode国家年 26 1301998 130 ECU厄瓜多尔1998 251301997 130厄瓜多尔1997 27 1302000 130 ECU厄瓜多尔2000 >country.n表示(1中的i:country.n){ +aaTypo/thinko.aa > head(data.6t

for()
中使用
plot()
时出错
(我试图通过使用for()进行重复来减少工作量)

>head(data.6times[3:7])#data.6times有40列
cyear ccode scode国家年
26 1301998 130 ECU厄瓜多尔1998
251301997 130厄瓜多尔1997
27 1302000 130 ECU厄瓜多尔2000
>country.n表示(1中的i:country.n){
+aaTypo/thinko.
aa
    > head(data.6times[3:7])  #data.6times has 40 columns
 cyear ccode scode country year
    26 1301998   130   ECU Ecuador 1998
    25 1301997   130   ECU Ecuador 1997
    27 1302000   130   ECU Ecuador 2000

    > country.n <- length(data.6times$country) / 6
    > for (i in 1:country.n){
    + aa <- 1+6(i-1)
    + bb <- 6+6(i-1)
    + plot.data <- data.6times[aa:bb,]
    + par(yaxt="n")
    + plot(plot.data$year,plot.data$cluster,ylim=c(0.8, 3.2))
    + text(plot.data$year, plot.data$cluster,labels=plot.data$country, cex=0.6, pos=1, col="blue")
    + text(plot.data$year, plot.data$cluster,labels=plot.data$transition, cex=0.6, pos=3, col="blue")
    + text(plot.data$year, plot.data$cluster,labels=plot.data$prior, cex=0.6, pos=2, col="blue")
    + text(plot.data$year, plot.data$cluster,labels=plot.data$post, cex=0.6, pos=4, col="blue")
    + par(yaxt="s")
    + axis(2, c(1,2,3), c("1","2","3"))
    + filename <- paste(c("/Users/Dropbox/Study/Dissertation/Result_fig/"),c("6times-"),i,c(".jpg"),sep="")
    + dev.copy(jpeg,file=filename,width=1200,height=800)
    + dev.off()
    + } 

    Error: attempt to apply non-function