Reputation: 637
I wonder if there is a way to mask the long list output of The following objects are masked from XXX(position 11):
every time I call attach()
function?
Upvotes: 22
Views: 125803
Reputation: 1
keep using detach(dataframe) multiple times till it returns "object not found" answer and then the masking response will go away
Upvotes: 0
Reputation: 51
It may be "better" to not use attach
at all. On the plus side, you can save some typing if you use attach
. Let's say your dataset is called mydata
and you have variables called v1
, v2
, and v3
. If you don't attach mydata
, then you will type mean(mydata$v1)
to get the mean of v1
. If you do attach mydata
, then you will type mean(v1)
to get the mean of v1
. But, if you don't detach the mydata
dataset (every time), you'll get the message about the objects being masked going forward.
detach
every time.Don't use attach
. Instead, include the dataset name every time you refer to a variable. The form is mydata$v1
(name of data set, dollar sign, name of variable).
As for me, I used solution 1 a lot in the past, but I've moved to solution 2. It's a bit more typing in the beginning, but if you are going to use the code multiple times, it just seems cleaner.
Upvotes: 5
Reputation: 29
You actually don't need to use the attach at all. I had the same problem and it was resolved by removing the attach statement.
Upvotes: -1
Reputation: 219
If you look at the down arrow in environment tab. The attached file can appear multiple times. You may need to highlight and run detach(filename)
several times until all cases are gone then attach(newfilename)
should have no output message.
Upvotes: 8