2 Some Basic Hints

  • One of the key points is to remember that R is picky. Really, really picky. R distinguishes upper case from lower case letters. Thus a variable named “Cost” differs from another variable named “cost”.

  • The way to learn new statistical software programs is through practice. There is a learning curve to R, but some text, the internet, or your classmates are good resources. You will feel really good when you figure things out, but you may struggle a bit in the process. The skills learned will be invaluable for you in the future.

  • There are many options as to how to work in R and authors disagree on what is the best way. You can develop your own style.

  • Check out Tools > Global Options > General tab in the menu bar of RStudio.

  • Before you start programming, plan a strategy as to how to address the question at hand.

  • You may want to familiarize yourself with a programming style. See Wickham’s style guide in his book Advanced R.

  • Comment your code thoroughly (using a # sign at the beginning of each line). Good documentation is a great reminder to you of what you are doing when you go back to the code another time and also helpful to your colleagues when you share your work.

  • The character ‘>’ at the far left in the R Console Window indicates that R is ready for you to enter a command.

  • You can use a keyboard shortcut to obtain the <- symbol. For PC users, click the Alt key along with - key while for those using a MAC, click the option key along with the - key.

  • Sometimes when you are typing in code in the console, or highlighting code to include in the console, you do not include enough information and instead of a ‘>’ to indicate that you have run the line, you end up with a ‘+’ instead. To delete the command and start anew, you can just click on the Esc key to return to the `>’.