Skip to content
Prev 169892 / 398506 Next

Odp: Problem with retrieving updated variables after attach()

Hi


r-help-bounces at r-project.org napsal dne 10.02.2009 12:02:53:
Look into docs what attach does. If you do not understand environments use 
attach with great care

The database is not actually attached. Rather, a new environment is 
created on the search path and the elements of a list (including columns 
of a data frame) or objects in a save file or an environment are copied 
into the new environment. If you use <<- or assign to assign to an 
attached database, you only alter the attached copy, not the original 
object. (Normal assignment will place a modified version in the user's 
workspace: see the examples.) For this reason attach can lead to 
confusion.
which
were
age
What about not using attach and transform mat directly
id      age
1 24 29.17842
2 88 31.22606
3 32 30.81540
4  5 29.31528
5 11 29.32775

Regards
Petr
http://www.R-project.org/posting-guide.html