1
1

More than 5 years have passed since last update.

Rのグローバル変数

Posted at
a <- function() {
      X <- 1
      X <<- X+1
      X <<- X+1
      return(X)
}
result <- a()
print(result)
print(X)

print(result)の結果、1表示され、
print(X)では2が表示されるってわけ

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1