Table of Contents»
Contributing Authors:
Ching-Ti Liu, PhD, Associate Professor, Biostatistics
Jacqueline Milton, PhD, Clinical Assistant Professor, Biostatistics
Avery McIntosh, doctoral candidate
This module will build additional skills in R programming by going beyound simple commands.
Outline:
- R as a programming language
- Grouping, loops and conditional execution
- Creating your own functions
Learning Objectives
By the end of this session students will be able to:
- Perform simple data manipulations: vectors (numeric, logical, character), missing values, index vectors, many-to-one, one-to-many merging
- Use grouped expression and if-else statements:
- Know how to write your own functions
Additional Tools:
- Reading in huge datasets: http://simplystatistics.org/2011/10/07/r-workshop-reading-in-large-data-frames/
- Web Scraping: http://thebiobucket.blogspot.com/2011/10/little-webscraping-exercise.html
- Sorting: use command sort(), e.g.
> sort( c(1,55,-2,11) )
[1] -2 1 11 55
- Generating a random permutation of a set of data:
> sample(c("First","Second","Third","Fourth"), replace=F)
[1] "Fourth" "First" "Third" "Second"