R语言问题,显示错误为:错误: 意外的'}' in "}"

Python022

R语言问题,显示错误为:错误: 意外的'}' in "}",第1张

# 看了一下楼主的编码 ,我的理解是把美国的hotdog 标记出来,修改如下:

    for(i in 1:length(hotdogs$Country)){

        if(hotdogs$Country[i]=="United States"){

            hotdogs$Country[i]<- c("#821122")}

        else{hotdogs$Country[i] <- c("#cccccc")}

    }

如果数据量比较大的话这样比较耗时间,建议用:

Country<- hotdogs$Country

index<- Country=="United States" 

Country[index]<- "#821122"

index1<-Country!="United States" 

Country[index1]<- "#cccccc"

print(Country)

虽然比较简单,但是速度较快。。。

acf(int[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int monthly

acf(int.l[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int monthly

log return')

Box.test(int[,2], lag = 5, type = "Ljung-Box")

Box.test(int[,2], lag = 10, type = "Ljung-Box")

Box.test(int.l[,2], lag = 5, type = "Ljung-Box")

Box.test(int.l[,2], lag = 10, type = "Ljung-Box")

运行结果有以下错误,怎么办?

>int <- read.table("d-intc7208.txt", head=T)

错误于file(file, "rt") : 无法打开链结

此外: 警告信息:

In file(file, "rt") :

无法打开文件'd-intc7208.txt': No such file or directory

+ acf(int.l[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int monthly

错误: 意外的符号 in:

"

acf(int.l[,2], lag.max = 15,type = "correlation", plot = TRUE,main='int"

>log return')

错误: 意外的符号 in "log return"