Section 1.9 Getting Comfortable Making Mistakes - Help and Advice
As previously stated, there are an innumerable amount of things that can be done in R. With so many capabilities, it is impossible to remember everything and get everything right all the time. Sometimes you may get errors when trying to run code. When your code does not work, try looking for:
-
Misspelling of function names
-
Unclosed brackets, parenthesis, or quotation marks
-
Spaces in names or columns
-
Not having the
<- -
Missing a required field from a function
A good portion of the time, R will provide you with an error message which will have the clues to exactly what is the problem. If at any time you need help, you can ask R. The formula to follow is (no parenthesis in this case):
-
?command_name
Imagine for the life of you you are unable to remember what
str() does. The below code is an example of how to ask R for help.
?str
Sometimes, you may encounter an issue that is really just giving you problems. In this case, my best advice is to step away from your computer for 5 minutes and take a deep breath. Just like learning a instrument or learning a new language, things take time.
