Sometimes the solution isn’t immediately obvious so it may require some trial and error - and that’s all part of the process too! It’s really hard to fix someone’s coding problem without context. The other person needs enough information and context to understand what you hope to achieve and what you’ve done so far to suggest a solution. If you can’t identify the problem, then you need to be able to describe your problem to another person. Make a habit of asking for help as your last option because for the assessment you will need to use R and troubleshoot independently. It is a skill you have to learn by doing, which means having a go yourself before seeking help from others. Learning to problem solve independently is not something you learn by reading or something you can be taught. The first thing is to retrace your steps and identify whether you’ve missed a step or misspelled something. ![]() If your code is not working then it’s likely that you’ve made an error somewhere - and that’s OK! It’s all part of learning how to program and there’s no shame in not getting it right the first time. The code to see the working directory in R is: getwd() # GET Working Directory. You can see which working directory is the default directory in RStudio on the “Files” tab. In contrast, the relative address for file B is even shorter, fileB, since folder 2 is already the working directory. /fileA which means that the computer is now looking in the documents folder. ![]() For example, if folder 2 was the working directory C:/documents/folder1/folder2 and we wanted to access file A, then we need to tell the computer to go up two directories. which tells the address to go up a directory. Navigating through directories using addresses can be confusing.Īnother useful command is. This way we don’t have to type C:/documents/folder1/ every time. If the default directory is C:/, then the address for file B is C:/documents/folder1/folder2/fileB.īut if we set folder 1 as the working directory C:/documents/folder1/, then we can use the relative address for the file: folder2/fileB. We can then use directory addresses that are relative to this default address to call files.įor example, following this directory structure: C: The working directory in R is the default directory R will look in first. There is a short cut if we use working directories. Remember directories? Typing out whole addresses starting from the hard drive is annoying. libPaths() in R to check that your personal library folder is now listed in RĬhanging default settings in the Control Panel is pretty advanced computing - we don’t expect you to know this.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |