Skip to content

Instantly share code, notes, and snippets.

@prasoonsharma
Created November 27, 2010 13:23
Show Gist options
  • Save prasoonsharma/717887 to your computer and use it in GitHub Desktop.
Save prasoonsharma/717887 to your computer and use it in GitHub Desktop.
Curriculum for Introduction to R
CURRICULUM FOR INTRODUCTION TO R (DRAFT)
Day 1:
a) Install R
b) Use R as a calculator
Day 2:
a) Getting help
b) Use variables in R
c) Understand atomic data types in R
Day 3:
a) Understand data structures in R
Day 4:
a) Understand Vector operations
Day 5:
a) Understand Data Frame operations
Day 6:
a) Understand Loops in R (for/while)
b) Understand Conditions in R (if/else)
Day 7:
a) Plot your first chart in R
- line chart
- bar chart
- bubble chart
Day 8:
a) Read data into R
- setwd()
- allocate memory
- local file
- URL
- Various formats supported: Excel, RDBMS etc.
- Skipping rows (and how data frame column type is derived from data in first 5 rows by default)
b) Write data from R
Day 9:
a) Understand R GUI
- Stopping a long calculation
- Saving a session
- Loading a saved session
- Saving your data
- Loading your data in a new session
- Sending someone your data
- Seeing the commands typed in a session
- Managing objects in a R session (ls, rm)
Day 10:
a) Write your own function
Day 11: Utilities
- Learn about Dates in R
- Learn Regex in R
- Learn about generating Random numbers in R
Day 12:
a) Understand NA in R
b) NaN vs. NA
c) How to deal with NA? ignore.NA
Day 13:
a) Understand Matrix operations
- t (transpose),
b) Understand Array operations
Day 14:
a) Understanding List operations
Day 15: Try a package from R
- R offers many libraries. Chances are that if you need one, there might be one already. Check out http://cran.r-project.org/web/views/
Day 16: Survived the first 15 days? Still interested? Get plugged in. See what others are doing with it.
- Subscribe to www.r-bloggers.com and ?
Day 17: Advanced charting functions
- manipulating a chart: par/custom axes/symbols/pch/text/fonts/mtext/line width
- polygon
- maps
Day 18: Unit testing
ref: http://www.johnmyleswhite.com/notebook/2010/08/17/unit-testing-in-r-the-bare-minimum/
Day 19: Organize your R code
ref: http://www.johnmyleswhite.com/notebook/2010/08/26/projecttemplate/
Day 20: Formula in R
Day 21: Handling large objects in R
- setting and managing memory()
- FF
- Execute SQL on R objects: sqldf
Day 22:
a) Code like a programmer
- R coding styleguide: http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html
- Including other R code in your R code (include)
- Implementing model functions in your code
- Generic functions
- IDE: http://www.rstudio.org
Day 23:
a) Making R run fast
- Profiling R code
- Avoiding loops and using apply, lapply, sapply, plyr functions
Day 24: Using R packages
a) Solving linear equations
b) Solving step functions
c) Hard Sudoku problem? Use R to solve it!
d) Regressions
e) Optimizations
Day 25:
-
Day 26:
-
Day 27:
-
Day 28:
-
Day 29:
-
Day 30: If you've managed to come this far, its time to get deeper. Get your own data set from the domain you're interested in (e.g. sports, crime, financial, growth) and play around with it. I found it very useful. See Indian state population/crime and Cricket analysis
----------------------------------------------------------------------------------------------------
To do:
- Add Exercises for each topic
- Add Screencasts for each topic like www.railscasts.net
Misc:
ave(x1,y1): averages of x1 grouped by factor y1
by(): apply function to data frame by factor
apply(x1,n1,function1): apply function1 (e.g. mean) to x by rows (n1=1) or columns (n2=2)
tapply(x1,list1,function1): apply function to x1 by list1
table(): make a table
tabulate(): tabulate a vector
http://cran.r-project.org/doc/contrib/refcard.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment