C Miscellaneous

C.1 Rules of using R

  • use RStudio
  • use RStudio in project-oriented environment
  • use RMarkdown files in RStudio
  • use as many comments as possible

C.2 Good to know

  • R is case sensitive: Apple and apple are different objects.
  • Use a semicolon to put two or more commands on a single line: a <- 2+2; a
  • Force R to print the value of expression by using parentheses: (a <- 2+2)

C.3 Why is my code broken?

  • Are all your parentheses in the right places?
  • Do you have commas where you should?
  • How’s your capitalization?
  • What about continuation prompt?
  • Did you load the package you’re trying to use?
  • If none of these fix your problem, try googling the error message R gives you. There’s usually a good StackOverflow question on whatever you’re trying to accomplish.

C.4 Other resources