Information on R
Here are some books I like on R, python, data science, machine Learning:
Books
Note on assignment
I tend to use x = 2 for assignment.
Most R users use x <- 2.
See this link: For a discussion
Note that you can call python from R:
R studio notes on package reticulate
R
Basic R links are:
Generic R: R.
Available via myASU, but it is more convenient to install on your own computer.
If you just google "how do I install R" you will have no problem:
But you just go to R project and then click on Download/CRAN at the left
hand side.
Some (most) of you may also want to use rstudio which gives you more
of a gui (visual point-and-click) interface to R.
rstudio also has a lot of nice tools built into.
Install R and then rstudio
Rstudio downloads are at: Rstudio download
Rstudio: R studio (now Posit)
Note that if you go to
http://swirlstats.com/students.html it tell you how
to get started installing R, rstudio, and swirl.
The official R documentation page is R documentation
and the official R intro is Introduction to R.
The writing in the R introduction can get very technical, but if you just read the initial parts of a section it is usually very good,
definitely worth a try.
This is a very simple introduction to R that Rob wrote for MBA's at Chicago:
Rob's Simple R Introduction
Short Reference Card
Google Tutorial
R Markdown
In data science ``dynamic documents'' in which code and math and the output form code are combined
have become very popular.
Rmarkdown (particularly in rstudio) has become very popular.
This seems like a nice tutorial from R bloggers:
Getting Started with R Markdown - Guide and Cheatsheet
Here is the rstudio webpage for Rmarkdown
rstudio on Rmarkdown
The rstudio cheatsheets are very useful, you can get them from the rstudio help,
but here they are:
rmarkdown cheatsheet (from the rstudio help)
rmarkdown-reference.pdf
See also Part V of ``R for Data Science'' by Wickham and Grolemund.
Try going into rstudio, clicking to get a new Rmarkdown file and the clicking knit.
Note that (if your Rmarkdown is simple) you can ``render'' the Rmarkdown to html or pdf (or word).
If you play around with this file and consult the cheatsheets you get the hang of it but
it takes a little while.
Mostly Rmarkdown is pretty easy, but some things can be tricky.
At the top of the fname.Rmd file there is a preamble that controls how the Rmarkdown is "rendered".
For example, you can render to pdf or html. It is not always easy to figure out how to get these
options to do what you want.
Rmarkdown has "code chunks" where you put in a chunk of R code.
There are then a lot of options on how the code and the output from the code are displayed.
In particular, you can cache (to disk) the results for a code chunk and specify which
previous chunks a chunk depends on. This way a chunk is only rerun when the code changes for
the code for a chunk that it depends on changes.
Here is an example where of a section of notes written in Rmarkdown (note the preamble):
markdown, pdf
Here is an example where a tutorial was written in Rmarkdown
(note the cache=TRUE option is some of the code chunks and the dependson= is subsequent chunks):
markdown, pdf
R packages for Machine Learning
CRAN Task View: Machine Learning & Statistical Learning
Hello world, stats in R
Hello world regression in R, Rmarkdown
Hello world regression in R, rendered html
Hello world regression in R, short version, rendered html
OOS Loop in R
Here is a simple example of a loop in R to estimate the out-of-same root mean square error
for linear regression and the susedcars.csv data set using just x=(mileage,year) for y=price:
do-cars-oos.R.
What is the oos loop trying to do?
Out of sample Loss..
Intro Statistics Notes on R
A First Look at R
first R, pdf
first R, html
first R, Rmd
first_R video
Data in R, Vectors, Lists, and Data Frames
R and Data, pdf
R and Data, html
R and Data, Rmd
Simple Data Analysis in R, plot and Simple Linear Regression
Simple data analysis, pdf
Simple data analysis, html
Simple data analysis, Rmd