Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Regrettably, R is a bit of it's own bizarro world, as far as how its commands work. (Futhermore, Googling "R" to get help can be very frustrating.) The conventions of most other programming and scripting languages seem to have been re-invented by someone who wanted to do everything their own way in R. Just like we wrote shell scripts in bash, you can write R scripts that carry out complicated analyses.

Warning
Do not copy the {{>}} characters in the R examples.
Do not copy the {{>}} characters in the R examples.

They are the R prompt to remind you which commands you are running the inside of R!

Basic rules of R:

  • Don't forget: it's q() to quit.
  • For help, type ?command. Try ?read.table. The q key gets you out of help, just like for a man page.
  • The left arrow <- (less-than-dash) is the same as an equals sign =. You can use them interchangeably.
  • The prompt we will sometimes be showing for R is >. Don't type this for a command. It is like the login1$ at the beginning of the bash prompt when you log in to Lonestar. It just means that you are in the R shell.
  • You can type the name of a variable to have its value displayed. Like this...
    Code Block
    > x <- 10 + 5 + 6
    > x
    [1] 21
    

...