Code to reproduce the problem:
Creates a data frame with one column "a".
dataObj=data.frame(a=1)
> dataObj
a
1 1
Attach dataObj
attach(dataObj)
> a
[1] 1
Modify dataObj, but the value of a is still unchanged.
dataObj[1,"a"]=3
> a
[1] 1
From ?attach
:
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.
A copy is added to the search path, not the object itself. When you modify the original, the copy is unchanged.
It is advised (by many) to avoid attach
. with
is a handy substitute.