R Lecture 1
R Lecture 1
1
Why R?
• R is Free!
• R is open source
• R runs on anything you run
• R is state of the art – researchers provide their methods for FREE!
• R has Excellent graphics
• R has an active user community, so help is close at hand
• R is excellent for simulation, programming, computer intensive
analyses etc.
• R forces you to THINK!
• R puts you at a distinct advantage in the workforce
Wrong answer: Dr. Rostant is evil, and wants us all to fail at life.
2
3
Disadvantages
• Steep learning curve
• Minimal GUI (try TINN-R or R-Studio)
• No commercial support
• Easy to make mistakes and not know
• Data prep and cleaning can be tricky
• Some people can be mean on the R listserve.
4
Learning R…….
5
R listserve……
6
What is R?
• A comprehensive statistical and graphical
programming language which is a dialect of
the S language.
• Initially written by Ross Ihaka and Robert
Gentleman at Department of Statistics of the
University of Aukland during the 1990s
7
Where can I get R?
• https://cran.r-project.org/
8
9
10
11
12
13
14
15
16
17
18
19
How do I start R up?
20
21
How does it work?
• You can go through “Introduction to R” in
Datacamp.
• https://www.datacamp.com/courses/free-
introduction-to-r
22
23
24
The importance of documenting your
code
•#
25
Editors
• Running R code requires you to type the code and
click enter.
• We recommend you use a text editor for copying
and passing into R.
• This allows you to easily save code.
• DO NOT USE MICROSOFT WORD!!!
• R’s own text editor, or Notepad
• Recommended editors: Tinn-R; Rstudio
• http://sourceforge.net/projects/tinn-r/
• http://www.rstudio.com/
26
Help Files and Newsgroups
• Wanna know something about a particular
command in R? Precede it with a ?
– ?boxplot
• Can also use help
– help(boxplot)
27
Help files
28
What’s with that + sign!
• If you get a + sign at the end of a line of code,
it indicates that R expects more code.
29
30
R help site
31
Quitting R
• q()
32
What to do now?
Attempt the Introduction to R course
Download R
33