"The following object is masked from..." (Complete beginner lost)

When I try to "attach" my data, I get this error. It doesn't always happen, but frequently enough. When I later want to make a plot I can't use the variables within the data.


If you attach an object that shares a name with another object that has been attached, you will get that warning. It isn't really an error, just notification that the latest object "blocks" the name of a previous object. Personally, I never use attach().

DF <- data.frame(Col1=1:3)
DF2 <- data.frame(Col0=11:13,Col1=21:23)
attach(DF2) #the name Col1 is in both data frames.
The following object is masked from DF:

1 Like

Oh I see. Thank you for the quick reply!

Hi again,
Is there any way to "de-attach" the data?

You can remove objects from the search path using the detach() function. You can also see what is on the search path with the search() function. The following example illustrates attaching and detaching a data frame named DF and monitoring the effect with the search() function. When DF is attached, it is placed in position 2, just after the .GlobalEnv

 [1] ".GlobalEnv"        "DF"                "tools:rstudio"    
 [4] "package:stats"     "package:graphics"  "package:grDevices"
 [7] "package:utils"     "package:datasets"  "package:methods"  
[10] "Autoloads"         "package:base"     
 [1] ".GlobalEnv"        "tools:rstudio"     "package:stats"    
 [4] "package:graphics"  "package:grDevices" "package:utils"    
 [7] "package:datasets"  "package:methods"   "Autoloads"        
[10] "package:base"  

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.