R Studio
R Studio
Hugh Murrell
Reference Books
These slides were created to accompany chapter two of the
text:
I SPUR: Scientific Programming and Simulation using R
Owen Jones, Robert Maillardet, and Andrew Robinson.
A version of this text can be found on the web.
Scientific Programming and Data Mining
I In this course we aim to teach scientific programming and
to introduce data mining.
I Scientific programming enables the application of
mathematical models to real-world problems.
I Data mining is the computational technique that enables
us to find patterns and learn classifiaction rules hidden in
data sets.
Scientific programming with R
I We chose the programming language R because of its
programming features.
I R is also rich in Statistical functions which are
indespensible for data mining.
I We do not only use R as a package, we will also show
how to turn algorithms into code.
I Our intended audience is those who want to make tools,
not just use them.
The R Programming Language
I This course uses the statistical computing system, R.
I R is based on the computer language S, developed by
John Chambers and others at Bell Laboratories in 1976.
I Robert Gentleman and Ross Ihaka developed an
implementation, and named it R and made it open source
in 1995.
I Hundreds of people around the world have contributed to
its development.
I The R Core Team is now responsible for development and
maintenance of R.
The R Package
I R is available at http://cran.r-project.org.
I This site is referred to as CRAN
I Most users download and install a binary version. This is
a version that has been translated (by compilers) into
machine language for execution on a given operating
system.
I R is designed to be very portable: it will run on Microsoft
Windows, Linux, Solaris, Mac OSX, and other operating
systems, but different binary versions are required for
each.
RStudio IDE
I RStudio is a free and open source IDE (integrated
development environment) for R.
I You can run it on your desktop (Windows, Mac, or Linux)
I You can run it over the web using RStudio Server.
I RStudio is available at http://www.rstudio.com
RStudio Screen Shot
The > sign tells you that R is ready for you to type in a
command.
Variables are created the first time you assign a value to them.
lim (1 + 1/x)x = e
x→∞
2.70
2.68
2.66
y
2.64
2.62
2.60
array(data, dim)
n
1
2
y
2 3
4
5
0 2 4
x
y = 1 + 2x + errors
and then try to estimate the intercept and slope from the data
and see how well you do.