From tlumley at u.washington.edu  Mon Oct 25 17:43:03 2004
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Mon Oct 25 17:43:18 2004
Subject: [Rd] <<- (PR#7313)
In-Reply-To: <20041025122442.4194C10434@slim.kubism.ku.dk>
References: <20041025122442.4194C10434@slim.kubism.ku.dk>
Message-ID: <Pine.A41.4.61b.0410250838360.243928@homer10.u.washington.edu>

On Mon, 25 Oct 2004 bvaillant@simon-kucher.com wrote:

> Full_Name: Boris Vaillant
> Version: 2.0
> OS: Win 2000
> Submission from: (NULL) (195.227.11.98)
>
>
> ##Maybe I have not fully understood the changements
> ##in R 2.0.
> ## Why is it that
>
> a <- 1:3
> names(a) <- 1:3
> # works fine, but
>
> b <<- 1:3
> names(b) <<- 1:3
>
> ## used to work in R 1.9
> ## and gives
>> Error: Object "b" not found
> ## in R 2.0 ?
>

It was a bug in R 1.9.1 that this worked when typed at the top level. <<- 
is for use inside functions, eg:
> f<-function(x){
    b <<- x
    names(b) <<- x
  }
> f(1:3)
> b
1 2 3
1 2 3



 	-thomas


[Rd] <<- (PR#7313)
Thomas Lumley