Lecture 2: Programming in R

Slides:



Advertisements
Similar presentations
B2PDF b2pdf is the new and innovative release of our powerful command line tool for PDF customization b2pdf is a robust stand alone PDF file generation.
Advertisements

Using R with Python.
Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
R for Macroecology Aarhus University, Spring 2011.
Foundation Level Course
SHOU Haochang ( 寿昊畅 ) Department of Biostatistics, Johns Hopkins Bloomberg School of Public Health July 11th, 2011 Nanjing University, China *Thanks to.
Text, Masks, and Live Effects – Lesson 41 Text, Masks, and Live Effects Lesson 4.
Lecture 2 LISAM. Statistical software.. LISAM What is LISAM? Social network for Creating personal pages Creating courses  Storing course materials (lectures,
Quark QuarkXPress 4 Foundation Level Course. What is QuarkXPress? This courseware teaches the fundamentals of QuarkXPress 4.1. It is a page layout application.
What is R Muhammad Omer. What is R  R is the programing language software for statistical computing and data analysis  The R language is extensively.
Introduction to MATLAB ENGR 1187 MATLAB 1. Programming In The Real World Programming is a powerful tool for solving problems in every day industry settings.
1 An Introduction – UCF, Methods in Ecology, Fall 2008 An Introduction By Danny K. Hunt & Eric D. Stolen Getting Started with R (with speaker notes)
AN INTRODUCTION TO GRAPHICS IN R. Today Overview Overview –Gallery of R Graph examples High-Level Plotting Functions High-Level Plotting Functions Low-Level.
- Circle markers produced by TAsimage: They do not match was is produced on screen. The line width is too thick. Some other markers need to be tune a bit.
Blackboard Learn 9.1 © 2013 Blackboard Inc. All rights reserved.
R-Graphics Day 2 Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
732A44 Programming in R.  Self-studies of the course book  2 Lectures (1 in the beginning, 1 in the end)  Labs (computer). Compulsory submission of.
Interface.  Menu  Document  Insert  Panel Management.
ENGR 1320 Final Review - Programming Major Topics: – Functions and Scripts – Vector and Matrix Operations in Matlab Dot product Cross product – Plotting.
Introduction to Engineering MATLAB – 6 Script Files - 1 Agenda Script files.
Using the ‘R’ Language for Bioinformatics
Digital Media Lecture 3: Image Encoding Bitmapped images Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
Blackboard Learn 9.1 © 2010 Blackboard Inc. All rights reserved.
R-Graphics Stephen Opiyo. Basic Graphs One of the main reasons data analysts turn to R is for its strong graphic capabilities. R generates publication-ready.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
© 2015 by Wade Rogers Introduction to R Cytomics Workshop December, 2015.
2. Point A dot; visible mark In typography, a point is a period – the definitive end of a line.
R tutorial Stat 140 Linjuan Qian
R PROGRAMMING FOR SQL DEVELOPERS Kiran Math Developer : Proterra in Greenville SC
Statistical Genomics Zhiwu Zhang Washington State University Lecture 29: Bayesian implementation.
Statistical Genomics Zhiwu Zhang Washington State University Lecture 11: Power, type I error and FDR.
Lecture 2 Functions Trevor A. Branch FISH 553 Advanced R School of Aquatic and Fishery Sciences University of Washington.
Introduction; font size
Lecture 10: GWAS by correlation
Your Poster Title Goes Here
Matlab Training Session 4: Control, Flow and Functions
Lecture 2: Programming in R
Washington State University
Welcome to the course! Meetings and communication: AC meetings
What is Business Intelligence?
Lecture 10: GWAS by correlation
Introduction to R Studio
R Programming Language
Introduction; font size
Teaching KS3 Computing Session 4 Theory: Boolean logic AND/OR/NOT
Introduction; font size 12
Lecture 10: GWAS by correlation
Geometric Network Toolset
Lecture 10: GWAS by correlation
Your Poster Title Goes Here
Lecture 2: Programming in R
Your Poster Title Goes Here
Your Poster Title Goes Here
Your Poster Title Goes Here
Your Poster Title Goes Here
Lecture 11: Power, type I error and FDR
2 types of scale factor problems
Your Poster Title Goes Here
Your Poster Title Goes Here
Programming For Big Data
R Course 1st Lecture.
Stat 251 (2009, Summer) Lab 2 TA: Yu, Chi Wai.
Introduction; font size 12
Introduction; font size 12
Your Poster Title Goes Here
Your Poster Title Goes Here
Lecture 29: Bayesian implementation
Introduction; font size 12
Your Poster Title Goes Here
Your Poster Title Goes Here
Presentation transcript:

Lecture 2: Programming in R Statistical Genomics Lecture 2: Programming in R Zhiwu Zhang Washington State University

Documents are on Blackboard for previous course Syllabus Homework Exam Grade distribution Picture

Current and future needs "By 2018, the US alone could face a shortage of 1.5 million managers and analysts with the know-how to investigate big data to make effective decisions" -McKinsey Global Institute, 2014 report

R You Ready for R? http://www.analyticsvidhya.com/blog/2014/03/sas-vs-vs-python-tool-learn/

R You Ready for R? http://www.analyticsvidhya.com/blog/2014/03/sas-vs-vs-python-tool-learn/

Robert Gentleman and Ross Ihaka Start with S in 1996 Open source Open packages

IF if(distribution=="norm") {addeffect=rnorm(NQTN,0,1) }else {addeffect=alpha^(1:NQTN)}

Function phenoSimu=function(X,h2,alpha,NQTN,distibution,seed){ Define function here }

List return(list(addeffect = addeffect, y=y, add = effect, residual = residual, QTN.position=QTN.position, SNPQ=SNPQ))

Loop myNQTL=c(3,10,20,50,100,200) for(i in 1:length(myNQTL)) { myv=validation(n=n,m=m,y=myps$y,X=X,residual=myps$residual,effect=myps$add,QTN.position=myps$QTN.position,addeffect=myps$addeffect,NQTL=myNQTL[i]) print(c(i,myNQTL[i],myv$fit,myv$accuracy)) }

Circular Migration Flow Plots in R https://gjabel.wordpress.com/2014/03/28/circular-migration-flow-plots-in-r/ library("migest") demo(cfplot_reg, package = "migest", ask = FALSE) #You can save the PDF version of the plot (which looks much #better than what comes up in my R graphics device) using : dev.copy2pdf(file = "cfplot_reg.pdf", height=10, width=10) #If you want to view the R script: file.show(system.file("demo/cfplot_reg.R", package = "migest"))

RG#98: Horizon plot (time series data) http://rgraphgallery.blogspot.com/2013_05_01_archive.html require(latticeExtra) #example data set.seed(123) mydat <- ts(matrix(cumsum(rnorm(150 * 10)), ncol = 10)) colnames(mydat) <- paste("TS", letters[1:10], sep = "-") #simple line plot xyplot(mydat, scales = list(y = "same")) # panel with different origin and scale: horizonplot(mydat, layout = c(1,12), colorkey = TRUE) +   layer(panel.scaleArrow(x = 0.99, digits = 1, col = "grey", srt = 90, cex = 0.7)) + layer(lim <- current.panel.limits(), panel.text(lim$x[1], lim$y[1], round(lim$y[1],1), font = 2, cex = 0.7, adj = c(-0.5,-0.5), col = "blue")) 

RG#100: Trellis map plot with heatmap colors http://rgraphgallery.blogspot.com/2013_05_01_archive.html require(maps) library(mapproj) worldmap <- map('world', plot = FALSE, fill = FALSE, projection = "azequalarea") country = worldmap$names set.seed(1234) var.2010 = rnorm (length (country), 20, 10) var.2011 = var.2010*1.1 + rnorm (length (country), 0, 1) var.2012 = var.2011*0.98 + rnorm (length (country), 0, 4) var.2013 = var.2011*0.98 + rnorm (length (country), 0, 30) worldt <- data.frame (country, var.2010, var.2011, var.2012, var.2013) mapplot(country ~ var.2011, worldt, map = map("world", plot = FALSE, fill = TRUE))

Demonstration

Highlight File input and output R objects myF$p IF and Loop Apply numeric vs. character vector, matrix, and data.frame, list myF$p IF and Loop Apply Graph Function