STAT 353 Tutorial 1.pdf - STAT 353 Tutorial 1 Start up RStudio You will notice immediately the R console This is where you will write your programs If

STAT 353 Tutorial 1.pdf - STAT 353 Tutorial 1 Start up...

This preview shows page 1 - 3 out of 4 pages.

1 STAT 353 Tutorial 1 Start up RStudio. You will notice immediately the R console. This is where you will write your programs. If at anytime you want to learn more about R, the webpage is located at: , this is also where R can be downloaded from for free! You can get to it from the Help menu -> R Help. If you want further instruction such as a more intensive tutorial go to the Help menu-> An Introduction to R . To keep track of your code, you can start a script. A script is a simple text editor that you can open using File menu -> New file -> R script. You can use another text editor if you would like, and run your code by copying and pasting it in. For example, Microsoft Word will allow you to copy and paste graphs directly from R. Type in the bold font in into your R console to explore what happens. 1. Getting help The most important command is help: help() help(matrix) This is helpful only if you already know the name of the function you want help on. You can also start a webpage with a search engine. help.start() 2. Arithmetic Basic arithmetic can be used in R using the following symbols: +, -, /, *, ^ or ** (exponents). 2*2^2 3. Creating Vectors You can create a vector with the " c " command: a <- c(1,2,3,5) b = c('red','blue','green') The " c " command produces a vector, and the " <- " or “=”command assigns it to the object a . You can print out an object by typing its name: a
2 ALL R objects are stored as files on disk. They will not be deleted at the end of a session.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture