Skip to content

Instantly share code, notes, and snippets.

@ZeccaLehn
Last active May 3, 2017 01:32
Show Gist options
  • Save ZeccaLehn/b6b543d5564b747a3d5846a93d1f6433 to your computer and use it in GitHub Desktop.
Save ZeccaLehn/b6b543d5564b747a3d5846a93d1f6433 to your computer and use it in GitHub Desktop.
Setting Variables in an R Anonymous Function
> 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