1

What's the difference between "<-" and "<<-" in R? I have read the help file in R. But I still don't understand their difference. Could any one provide an example? Thanks a lot!

Alwang
  • 11
  • 1
  • 1
    From [@kohske's answer](http://stackoverflow.com/questions/9851655/why-is-using-frowned-upon-and-how-can-i-avoid-it/9851794#9851794): "< – talat Jul 25 '14 at 09:05
  • This is not the exact duplicate of @beginneR link, but this should be marked as one so the provided link will educate newbies how to properly use this operator – David Arenburg Jul 25 '14 at 09:12

1 Answers1

0

used inside a function, the standard "<-" operator defines a variable inside this function and the variable will not be available outside.

Using "<<-" enables your function to define a variable outside, aka in the global environment, for further use.

That is quite useful in fact!

agenis
  • 7,337
  • 5
  • 44
  • 92