我正在多次对国家列表进行分析,并且在每次迭代期间,应将结果添加到向量中。下面我展示了一个简化的例子,没有一个国家的循环。即使我彻底寻找解决方案,我也找不到答案。
#this is my simplified country vector with just 1 country
country<-c("Spain")
#This is the vector that should hold the results of multiple iterations
#for now, it contains only the result of the first iteration
Spain.condition1<- 10
#reading result vector in a variable (this is automized in a loop in my code)
resultVector<-paste(country,"condition1",sep=".")
#when I call the content of the vector with parse, eval
#I see the content of the vector as expected
eval(parse(text=resultVector))
#however, when I try to add a second result to it
eval(parse(text=resultVector))[2]<-2
#I get following error message:
#Error in file(filename, "r") : cannot open the connection
#In addition: Warning message:
#In file(filename, "r") :
# cannot open file 'Spain.condition1': No such file or directory
任何人都可以帮助我或让我朝着正确的方向前进吗?