[R] Issue with special assignment operator

AROONALOK PYNE aroonalok.pyne at gmail.com
Mon Mar 17 05:06:13 CET 2014


Hi

Please explain why the function 'foo()' is not printing x as 8 in the
following code :

> foo <- function(){
+ x <- 10
+ if(x){
+ x <<- 8
+ }
+ print(x)
+ }
> foo()
[1] 10
> x
[1] 8
>

-- 
*AROONALOK PYNE*

BE Graduate
Department Of Computer Science And Engineering
Jadavpur University, Kolkata-32
India



More information about the R-help mailing list