Notes and links on R.
Why/Why not R
- “simply start over and build something better” | Xi’an’s Og; follow up by Andrew Gelman - Ross Ihaka to R: Drop Dead - Statistical Modeling, Causal Inference, and Social Science
Books and manuals
- Introduction to statistical thinking using R; without calculus. Jun 2011.
- Teach Yourself R (pdf) is a nice Q&A styled short manual.
- Learn Statistics with R (pdf) is a 500+ page book on learning stats with R from researchers at Adelide University.
- R tutorial by Prof. Kelly Black
- Practical tools for exploring data and models, PhD thesis of Hadley Wickham.
- R for Data Science (Free online book by Garrett Grolemund & Hadley Wickham)
- Cookbook for R by Winston Chang; solutions to common tasks and problems in analyzing data.
- Using R for psychological research a tutorial.
- Book recommendations discussion.
- One Page R: A Survival Guide to Data Science with R
- Graphical Data Analysis with R; via Andrew Gelman
- Impatient R; a short tutorial.
- Introduction to R by Larry Wasserman.
- Manning | Practical Data Science with R
- RStudio – user interface for R. It’s free and open source, and works on Windows, Mac, and Linux.
- Swirl – its purpose is to teach users statistics and R simultaneously and interactively.
- RKWard is nicer looking.
- R Commander is a
tcl/tk based interface.
sudo apt-get install r-cran-rcmdr
- Interactive Documents with R see demo.
- Publish R documents (code+words)
- Knitr is an important tool for reproducible research. A brief guide
- Emacs can communicate with R using ESS.
- Concepts in computing with data Stats 133, Spring 2011, Berkeley. R+XML+Databases. 350 page notes.
- Data Technologies for Statistical Analysis Stat585, Spring 2014, Iowa state by Dianne Cook.
- http://www.r-bloggers.com/. Aggregates R related blogs. feed
- http://rud.is/b/ – data science + infosec + R
- http://strengejacke.wordpress.com/tag/rstats/ [code]
- http://www.jameskeirstead.ca/tag/rstats/ [code, vis]
- http://andrewgelman.com/ - Andre Gelman is a popular author of Stats books and a regular blogger on applications of stats in “civilian” life.
- 24 days of R
- Home - RWeekly.org
R packages for undergraduate stat ed [Aug 2015]
devtools to make your life as a package developer easier by providing R functions that simplify many common tasks
- sqldf is an R package for runing SQL statements on R data frames, optimized for convenience.
- ggplot2 popular graphing package; replacement for the default plotting routines.
- chloroplethr – for plotting spatial, geographical data.
- swirl – is a software package for the R statistical programming language. Its purpose is to teach users statistics and R simultaneously and interactively.
- dplyr set of tools for efficiently manipulating datasets in R. dplyr is the next iteration of plyr, focussing on only data frames.
- sparkTable sparklines in R.
- slopegraph Tufte’s slopegraphs in R.
- RCPP provides C++ classes that greatly facilitate interfacing C or C++ code in R packages using the .Call() interface provided by R.
- https://github.com/huebner/Rlabs – R code for undergrad statistics course
- rstudio spark (google search) for R-shiny projects.
- Tale of two conferences: basketball use of R-Shiny
- Subsetting to clean your data
Tech notes, papers and articles on R
- Revolution analytics white papers
Installing R and contributed libraries.
R is made of r-core and thousands of contributed libraries. To begin with, we need to install the core application.
$ sudo apt-get install r-base-core
R and PostgreSQL
Preparing R to query data from postgresql. Reference.
$ sudo apt-get install libpq-dev $ sudo apt-get install r-base-core $ export PG_LIB_DIR=/usr/lib/postgresql/8.4/lib/ $ export PG_INCLUDE_DIR=/usr/include/postgresql
Install R packages from the bash/zsh shell
export CRAN_MIRROR="http://cran.case.edu/" echo "install.packages(\"rjson\", repos=\"$CRAN_MIRROR\")" | R --vanilla
source("http://bioconductor.org/biocLite.R") biocLite("RdbiPgSQL") library(RdbiPgSQL) conn <- dbConnect(PgSQL(), host="localhost", dbname="somedb", user="pradeep", password="secret") res <- dbSendQuery(conn, "SELECT a,b,c from sometable") mydata <- dbGetResult(res)
To make a R file into an executable script do the following:
#!/usr/bin/env Rscript # one.R # chmod +x one.R # ./one.R y=c(12,15,28,17,18) x=c(22,39,50,25,18) mean(y) mean(x) png(filename="plot.png") plot(x,y)
 18  30.8
plot.png written to disk.