On Thu, Jul 2, 2009 at 4:34 AM, Rolf Turner <r.tur...@auckland.ac.nz> wrote:

>
> On 2/07/2009, at 12:20 PM, Hsiu-Khuern Tang wrote:
>
>  Is this expected behavior?
>>
>>  z <- 1:5
>>> z[1] <<- 0
>>>
>> Error in z[1] <<- 0 : object "z" not found
>>
>> The documentation seems to suggest that z will be found in the global
>> environment and modified accordingly.
>
>
Still, the error message sounds confusing because how comes that `<<-` can
find z but `[<<-` (which doesn't even seem to exist -- but does seem to
work) can't?

Now try:

> z <- 1:5
> local(z[3] <<- 1000)
> z
[1]    1    2 1000    4    5

Kenn

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to