The following object is masked from myData (pos =4):

I am new to R and I am importing a large data set from excel and it works until I use the attach function.
Whenever I try to attach my data it says the following objects are masked from myData (pos = 4):
what does this mean and how can I fix it?

Hi, and welcome!

Please see the FAQ: What's a reproducible example (`reprex`) and how do I do one? Using a reprex, complete with representative data will attract quicker and more answers. This one doesn't strictly require one, but requires some speculation on my part.

If you try to attach a variable from a data frame with a name that conflicts with a reserved name, such as data, you might well see this.

Second, attach is not an optimal approach to dealing with related data. Besides the initial proliferation of data that's already available within the source object, it presents unnecessary complexity in gluing pieces back together.

An alternative is my_data$name to extract a single variable, which has the advantage of neither conflicting with the reserved name or adding another variable to the namespace.

1 Like

Thank you! that worked

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.