在R

时间:2016-09-16 14:28:56

标签: r vector global-variables

我想通过一个函数填充一个向量,该向量在我的代码中是全局的:

## The vector
x = c( NA, NA, NA )

## changing its value
x[1] <- 1 # fine
x[1] <<- 1 # not fine

Error in x[1] <<- 1 : object 'x' not found

那一定是一些非常基本的R,但是我无法看到如何将这个值全局存储。

0 个答案:

没有答案