Skip to content
Prev 277521 / 398506 Next

Reading data/variables

Hi,

The obvious answer is don't use attach() and you'll never have
that problem. And see further comments inline.
On Tue, Nov 15, 2011 at 6:05 PM, Steven Yen <syen at utk.edu> wrote:
Look there. R even *told* you that it was going to use the
y in the global environment rather than the one you were
trying to attach.

The other solution: don't save your workspace. Your other
email on this topic suggested to me that there is a .RData
file in your preferred working directory that contains an
object y, and that's what is interfering with what you think
should happen.

Deleting that file, or using a different directory, or removing
y before you attach the data frame would all work.

But truly, the best possible strategy is to avoid using attach()
so you don't have to worry about which object named y is
really being used because you specify it explicitly.