adplus-dvertising
frame-decoration

Question

What will be the output of the following R code snippet?
> g <- function(x) {
+             a <- 3
+             x+a+y
+          ## 'y' is a free variable
+ }
> g(2)

a.

9

b.

42

c.

8

d.

Error

Posted under R Programming

Answer: (d).Error

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following R code snippet?