[R] Is = now the same as <- in assigning values

2008-12-15 Thread Petter Hedberg
I´m a PhD student at the University of Warsaw, and have started using R. In many books they specify to use <- instead of = when assigning values, and this is also mentioned in older posts on the R website. However, it seams to me that some update has occured, becuase I continously get the same res

Re: [R] Is = now the same as <- in assigning values

2008-12-15 Thread Jorge Ivan Velez
Dear Petter, Take a look at this post: http://www.nabble.com/What-to-use-for-assignment,-"-%3D-"-or-"-<--"--to16521827.html#a16521827 HTH, Jorge On Mon, Dec 15, 2008 at 4:26 PM, Petter H

Re: [R] Is = now the same as <- in assigning values

2008-12-15 Thread Gabor Grothendieck
In most cases <- and = are the same yet its not always true so its safest to use <- for assignment. Check this out: http://tolstoy.newcastle.edu.au/R/e4/help/08/06/12940.html On Mon, Dec 15, 2008 at 4:26 PM, Petter Hedberg wrote: > I´m a PhD student at the University of Warsaw, and have started

Re: [R] Is = now the same as <- in assigning values

2008-12-15 Thread Wacek Kusnierczyk
Petter Hedberg wrote: > I´m a PhD student at the University of Warsaw, and have started using R. > In many books they specify to use <- instead of = when assigning > values, and this is also mentioned in older posts on the R website. > > However, it seams to me that some update has occured, becuase

Re: [R] Is = now the same as <- in assigning values

2008-12-15 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote: > Petter Hedberg wrote: > >> I´m a PhD student at the University of Warsaw, and have started using R. >> In many books they specify to use <- instead of = when assigning >> values, and this is also mentioned in older posts on the R website. >> >> However, it seams to me

Re: [R] Is = now the same as <- in assigning values

2008-12-16 Thread Petter Hedberg
Thank you all for the reply. I´ll start using <-. Best regards, Petter Hedberg University of Warsaw. 2008/12/16 Gabor Grothendieck : > In most cases <- and = are the same yet its not always > true so its safest to use <- for assignment. > > Check this out: > > http://tolstoy.newcastle.edu.au/R/

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Kenn Konstabel
Hi, On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk < waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: > ... but this is also legal if you really hate <- : > > foo({x = 2}) > # assign to x, pass to foo as a > This is legal but doesn't do what you probably expect -- although documentation for `<-

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Peter Dalgaard
Kenn Konstabel wrote: > This is legal but doesn't do what you probably expect -- although > documentation for `<-` says the value (returned by <-) is 'value' i.e. > whatever is on the right side ... > >> x<-NULL # just to make sure it's not yet 42 >> foo <- function(a) a >> foo({x = 42}) # no

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Duncan Murdoch
On 12/18/2008 10:13 AM, Kenn Konstabel wrote: Hi, On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk < waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: ... but this is also legal if you really hate <- : foo({x = 2}) # assign to x, pass to foo as a This is legal but doesn't do what you probabl

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Kenn Konstabel
On Thu, Dec 18, 2008 at 5:26 PM, Peter Dalgaard wrote: > > bar <- foo({x = 42}) > > bar > [1] 42 > > > What you're seeing is effectively > > > foo(invisible(42)) > > i.e. the result is there, just not printing. > Thanks for explaining. This is cleverer and much less obscure than I suspected. Bes

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Wacek Kusnierczyk
Kenn Konstabel wrote: > Hi, > > On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk < > waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: > > >> ... but this is also legal if you really hate <- : >> >> foo({x = 2}) >> # assign to x, pass to foo as a >> >> > > This is legal but doesn't do what yo

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Wacek Kusnierczyk
Kenn Konstabel wrote: > > If you really hate <-, you should do either > foo({(x=42)}) # or > foo({x=42; x}) # or even ... > foo(a=force(x=43)) > if you think the use of force guarantees that x is assigned 43, you're wrong. foo = function(a) 0 x = 1 foo(a=force(x=2)) x foo = function(

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Wacek Kusnierczyk
Wacek Kusnierczyk wrote: > Kenn Konstabel wrote: > >> Hi, >> >> On Tue, Dec 16, 2008 at 9:13 AM, Wacek Kusnierczyk < >> waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: >> >> >> >>> ... but this is also legal if you really hate <- : >>> >>> foo({x = 2}) >>> # assign to x, pass to foo as a >

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Stavros Macrakis
On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk < waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: > Kenn Konstabel wrote: > >> ...foo({x = 2}) > ... > > This is legal but doesn't do what you probably expect -- although > > documentation for `<-` says the value (returned by <-) is 'value' i.e. > >

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk < > waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: > > >> Kenn Konstabel wrote: >> ...foo({x = 2}) >> ... >> >> This is legal but doesn't do what you probably expect -- although >> >>> docume

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Peter Dalgaard
Stavros Macrakis wrote: On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk < waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: Kenn Konstabel wrote: ...foo({x = 2}) ... This is legal but doesn't do what you probably expect -- although documentation for `<-` says the value (returned by <-) is 'v

Re: [R] Is = now the same as <- in assigning values

2008-12-18 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: > On Thu, Dec 18, 2008 at 1:37 PM, Wacek Kusnierczyk < > waclaw.marcin.kusnierc...@idi.ntnu.no> wrote: > > > >> who said = is more intuitive for assignments? i said i prefer it, and >> that's because of aesthetics, silly me. in an earlier post, someone >> said it is