Open rebecalopes-ds opened 4 years ago
You can first find your current working directory by typing:
getwd()
The answer from R will be something like this:
[1] "C:/Users/your_computer_name_appears_here/Program Files"
Then you can change the R working directory to somewhere else where you will be able to create a subdirectory and modify files. For example:
setwd("C://Users//your_computer_name_appears_here//Documents")
You will check that this worked by typing:
getwd()
Then you create a subdirectory there (assuming that you did set the directory above correctly):
dir.create(“testdir“)
Another option is to type the full path like shown below:
dir.create("C://Users//your_computer_name_appears_here//Documents/testdir")
You can then change the working directory to that subdirectory:
setwd("C://Users//your_computer_name_appears_here//Documents//testdir")
To test that you did it correctly you can type:
getwd()
################################################### Another way to do it is to create a directory/subdirectory using Windows Explorer or the filer explorer you use (a location where you will be allowed to create it and modify its contents). For your situation the name of that directory or subdirectory will be testdir. You can create it for example inside your "Documents" directory. Then when that directory exists you will go into R and provide a path to that location. You can copy the path from the file manager, paste it into a notepad text file and modify the path so that it will have double forward slashes instead of single backslashes. Then copy that path into a setwd() command R as shown below:
setwd("C://Users//your_computer_name_appears_here//Documents//testdir")
To test that you did it correctly you type:
getwd()
Hello,
I can not complete exercise 2 since I can not edit the workspace (R is installed in folder program files, which is uneditable).
|============================= | 41% | Use dir.create() to create a directory in the current working directory | called "testdir".
| Nice work!
|=============================== | 44% | We will do all our work in this new directory and then delete it after we are | done. This is the R analog to "Take only pictures, leave only footprints."
...
|================================ | 46% Set your working directory to "testdir" with the setwd() command.
What can I do to complete the exercise?