What will be the output of the following R code? [code] > g <- function(x) { + a <- 3 + x+a+y +

Giang Phạm

New member
What will be the output of the following R code?
Code:
> g <- function(x) {
+               a <- 3
+               x+a+y
+             ## 'y' is a free variable
+ }
> y <- 3
> g(2)
A. 9
B. 42
C. 8
D. Error
 

Tìm kiếm

Back
Top