Hi,
I'm a bit confused by masking. Thought I understood, but today makes me
wonder.
x=0:9
y=0:9
sm=data.frame(x=4:8,y=9:13)
attach(sm)
x
detach(sm)
The code produces this message:
> attach(sm)
The following object is masked _by_ .GlobalEnv:
x, y
> x
[1] 0 1 2 3 4 5 6 7 8 9
I guess I thought that when you attach a dataframe, then the values in the
dataframe now override any existing variables in your workspace with the
same name. But this example seems to say that if I have something in my data
frame with the same name as an existing variable in my workspace, if I
attach the data frame, then it won't be the variable in the data frame that
is in play, but the existing variable in my workspace.
Have I learned my lesson?
And what are those commands that help you see what will be searched first,
second, third ... for a variable in your code?
D.
--
View this message in context:
http://r.789695.n4.nabble.com/Masking-tp4676137.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.