+ Reply to Thread
Results 1 to 3 of 3

Thread: In R programming language, is there any difference between "<-" and "="?

  1. #1
    Points: 1,728, Level: 24
    Level completed: 28%, Points required for next Level: 72

    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    In R programming language, is there any difference between "<-" and "="?



    In R programming language, is there any difference between "<-" and "="?

  2. #2
    R purist
    Points: 13,440, Level: 75
    Level completed: 48%, Points required for next Level: 210
    TheEcologist's Avatar
    Location
    The Netherlands.
    Posts
    1,287
    Thanks
    113
    Thanked 251 Times in 127 Posts

    Re: In R programming language, is there any difference between "<-" and "="?

    Quote Originally Posted by surfreta View Post
    In R programming language, is there any difference between "<-" and "="?
    I dont think so ... but lets check -> a quick look at the syntax descriptions would lead me to believe there is indeed no difference.

    http://stat.ethz.ch/R-manual/R-devel...ml/Syntax.html
    The true ideals of great philosophies always seem to get lost somewhere along the road..

  3. #3
    RotParaTon
    Points: 46,287, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Discussion EnderPosting AwardFrequent PosterCommunity AwardMaster Tagger
    Dason's Avatar
    Location
    Ames, IA
    Posts
    9,083
    Thanks
    211
    Thanked 1,609 Times in 1,379 Posts

    Re: In R programming language, is there any difference between "<-" and "="?


    In terms of assignment there is no difference. But note there are times when you can use the = but not <-. When you're specifying parameters inside of functions you need to use = and using <- will mess things up. I personally prefer to always use <- for assignment. That way we keep <- and = distinct (if I see a <- I know it's for assignment, if I see a = I know it's for something else). Plus if you want to do a global assign that is <-- but you can't do a global assign using =.

    Also note that although I discourage the use of it you can do something like
    Code: 
    c(1,2,3,7) -> x
    and that will store that vector into x. If you use = you are forced to do a 'leftwise' assignment. Like I said I don't like to do this (at least if I'm writing a script) but it can come in handy if I compute something and have R evaluate it then realize I want to save it because you can just hit up and then add "-> var1" or whatever you want to call it.

+ Reply to Thread

Similar Threads

  1. Replies: 0
    Last Post: 11-25-2010, 02:55 PM
  2. Replies: 2
    Last Post: 10-04-2010, 06:41 PM
  3. Replies: 4
    Last Post: 06-10-2010, 12:56 PM
  4. Replies: 1
    Last Post: 09-23-2009, 12:32 AM
  5. "Hepatitis" and "Golf" probabilities.
    By DAI&DF in forum Probability
    Replies: 7
    Last Post: 06-01-2008, 06:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts








Advertise on Talk Stats