Last active
May 3, 2017 01:32
-
-
Save ZeccaLehn/b6b543d5564b747a3d5846a93d1f6433 to your computer and use it in GitHub Desktop.
Setting Variables in an R Anonymous Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> function(){x <- 1} | |
function(){x <- 1} | |
> x | |
Error: object 'x' not found | |
> y = 3 | |
> (function(x = 5 + y) x)() | |
[1] 8 | |
> x | |
Error: object 'x' not found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment