a*****8 发帖数: 110 | 1 Tried to run: attach(mydata)
Got this:
The following object(s) are masked from mydata ( position 3 ) :
gender q1 q2 q3 q4
I thought it was becuae I have objects gender q1 q2 q3 q4 in my workspace.
But it still didn't work after I removed them.
Thanks! |
s*****n 发帖数: 2174 | 2 Did you attach multiple times? If so, you need to detach multiple times
accordingly.
BTW, R tip #1, never do attach(). You may avoid typing some letters in a
short term, but in the long run, you may get into trouble sooner or later. |
q**j 发帖数: 10612 | 3 it is position 3. check what is in your position 2. |
a*****8 发帖数: 110 | 4 Thanks so much for your reply!
Yes, I did.
I am not sure if I did an attach and didn't detach when I saved my workspace
. But I colsed everything and restart R, attach is still not working. |
a*****8 发帖数: 110 | 5 OK, I just start a new session.
> mydata
gender q1 q2 q3 q4
1 f 1 1 5 1
2 f 2 1 4 1
3 f 2 2 4 3
4 3 1 NA 3
5 m 3 5 2 4
6 m 5 4 5 5
7 m 5 3 4 4
8 m 4 5 5 5
> attach(mydata)
The following object(s) are masked _by_ .GlobalEnv :
gender q1 q2 q3 q4
>
What is the problem? Thanks! |
s*****n 发帖数: 2174 | 6 you probably saved workspace before, and when you restart R, it loads the
default workspace automatically, which includes the previous definition or
attachment of gender, q1...q4.
What you can do is:
1. find out the default working directory of your R, and then delete the .
RData file. In Windows, it is usually your R installation directory, and in
Unix, it is usually the current directory.
2. You can also do a rm(list=ls()), which erases everything in the memory
and then do a save workspace to |
a*****8 发帖数: 110 | |
q**j 发帖数: 10612 | 8 if you read the starting chapter of the little book, it tells you how to avo
id this kind of situation by modifying the Rgui setup.
【在 a*****8 的大作中提到】 : Thank you so much!
|
a*****8 发帖数: 110 | 9 What little book? Thanks! |
h***i 发帖数: 3844 | 10 little sas book
【在 a*****8 的大作中提到】 : What little book? Thanks!
|
|
|
a*****8 发帖数: 110 | 11 Are you sure, it's all about SAS |
h***i 发帖数: 3844 | 12 没看前文,sorry
【在 a*****8 的大作中提到】 : Are you sure, it's all about SAS
|
a*****8 发帖数: 110 | 13 Nevermind, thanks anyway! |
q**j 发帖数: 10612 | 14 sorry. the little book i wrote. taste of r.
【在 a*****8 的大作中提到】 : Nevermind, thanks anyway!
|
a*****8 发帖数: 110 | 15 Thanks! I will go look at it! |