R Programming for Quantitative Finance.pdf



Comments



Description

Computational Finance and Risk ManagementR Programming for Quantitative Finance Guy Yollin Applied Mathematics University of Washington Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 1 / 53 Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 2 / 53 Lecture references J. Adler. R in a Nutshell: A Desktop Quick Reference. O’Reilly Media, 2010. Chapters 1-3 W. N. Venables and D. M. Smith. An Introduction to R. 2013. Sections 1-3 Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 3 / 53 Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 4 / 53 The R programming language R is a language and environment for statistical computing and graphics R is based on the S language originally developed by John Chambers and colleagues at AT&T Bell Labs in the late 1970s and early 1980s R (sometimes called “GNU S" ) is free open source software licensed under the GNU general public license (GPL 2) R development was initiated by Robert Gentleman and Ross Ihaka at the University of Auckland, New Zealand in the 1990s R is formally known as The R Project for Statistical Computing www.r-project.org Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 5 / 53 2 Data visualization −0.4 Jan 96 Jan 97 Jan 98 Jan 99 Jan 00 Jan 01 Jan 02 Jan 03 Jan 04 Jan 05 Jan 06 Dec 06 Date Plot from the PerformanceAnalytics package Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 6 / 53 .05 Statistical modeling 0.5 Data manipulation 2.1 Drawdown −0.0 Cumulative Return 2.0 Data analysis 0.5 1.0 −0.00 −0.05 Monthly Return 0.Strengths of the R programming language HAM1 Performance 4.0 1.3 −0.0 HAM1 EDHEC LS EQ 3.10 −0.5 SP500 TR 3. Inc. Inc.AT & T Bell Labs S-PLUS (S plus a GUI) Statistical Sciences. CompFin Program Director Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 7 / 53 . John Chambers.S language implementations R is the most recent and full-featured implementation of the S language Original S . 2006 Computing † Founded by UW Professor Doug Martin. R .† Mathsoft. Tibco. Inc. Insightful.The R Project for Statistical Figure from The History of S and R. Inc. R 1.4.0.x.x) (S+ 5.0) and Graphics Award Work on S 1997 R 2.0 S: An Interactive Envirnoment for (S4) 2002 2010 2000 Data Analysis and Graphics 1988 Modern Applied Statistics R&R R 1.5.0 Version 1 R on CRAN GNU Project 1976 2011 Modern Applied Statistics StatSci Licenses S Exponential S-PLULS with S-PLUS 1993 2nd Edition growth of developed by Modern Applied Statistics 1997 Modern Applied Statistics R Users and Statistical Sciences.R timeline 1991 1999 Statistical Models in S John Chambers (white book) 1998 ACM Software Award S3 methods 2001 1984 R 1. Inc. 5. with S-PLUS with S-PLUS R packages 1988 1994 Programming with Data 3rd Edition (Green Book) (S+ 2000.0.0 (Brown Book) The New S Language with S Given ASA 1993 (S3) Written in C 4th Edition Statistical Computing R on Statlib 2004 (Blue Book) (S+ 6.x) (R complements) 1998 1999 S era S-PLUS era R era Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 8 / 53 . and work in initiating the R manipulate data Project for Statistical Computing Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 9 / 53 . Chambers’ work Statistical Computing and will forever alter the Graphics Award way people analyze. In recognition for their visualize.Recognition of software excellence Association for Computing American Statistical Machinery Association John Chambers received the 1998 Robert Gentleman and Ross ACM Software System Award Ihaka received the 2009 ASA Dr. Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 10 / 53 . is. 2.. RMySQL. x[-(1:n)] elements from n+1 to the end sink(file) output to file.image(file) saves all objects Definitely obtain these PDF files from the R homepage or a CRAN mirror Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 11 / 53 . data file created with save.character(x). the file connection can also be used with description = x[x %in% c("a".sep="\t".nrow=.to) generates a sequence by= specifies increment.] row i summary(a) gives a “summary” of a. as.. test for type.breaks) divides x into intervals (factors).) combine arguments by rows for matrices. see packages RODBC....char="" to prevent "#" from being interpreted as ifying the pattern of their levels. to sort in decreasing is an integer vector. if quote is TRUE. and R variables.row. convert type.numeric(x). elements of x recycle row matrix header=TRUE to read the first line as a header of column names.length=n*k.) create a data frame of the named or unnamed is.4.numeric(x).3. use x[i.as.4. is. column j str(a) display the internal *str*ucture of an R object To write a table to the clipboard for Excel. as.widths.2.2)] specific elements help(topic) documentation on topic Most of the I/O functions have a file argument. and x[. is. NA treatment. sep is the x[n] nth element field separator. library(help=x) lists datasets and as.. the default separator sep="" is any whitespace.. use Indexing matrices help. class(x) <.2) is 1 2 3 1 2 3..com 2005-07-12 print(a. with recursive=TRUE descends through lists combining all methods(class=class(a)) lists all the methods to handle objects of elements into one vector class a from:to generates a sequence. as.n=10). is.is=FALSE) rev(x) reverses the elements of x read a table of f ixed width f ormatted data into a ’data."d").each=2) is 1 1 2 2 3 3 Variable information detach(x) x from the R search path. use skip=n to skip n lines before reading data. “:” has operator priority.delim("clipboard") x[i. until sink() x[c(1. .j] element at row i.k. but with defaults set which.b="hi". for columns as. for a complete list. . or R . is.names=TRUE.data. and others expand.table(x. by columns read.) generic function to combine arguments with the default forming a methods(a) shows S3 methods of a x$name id. and n is unclass(x) remove the class attribute of x a comment.M.frame(.frame(x). rep(c(1.."B". length(x).table(file) reads a file in table format and creates a data dim=c(3. data.grid() a data frame from all combinations of the supplied vec. na is the string for x[-n] all but the nth element Help and basics missing values.fwf(file.c(3.sep="".times) replicate x times."and".logical(x). DBI..names=TRUE.2) data(x) loads specified data sets array(x.array(x).table(x. see the the number of replications attr(x.col. meaning it can have differ.csv("filename".na(x).) saves the specified objects (. usually a statistical summary but it is write. generic.names=NA) x[.str() str() for each variable in the search path Data creation Indexing data frames (matrix indexing plus the following) dir() show files in the current directory x[["name"]] column named "name" c(.labels=1:n) generate levels (factors) by spec. netCDF for reading other file formats. error specifies desired length library(x) load add-on packages. rep(x. RPgSQL.) create a list of the named or unnamed arguments.2.file="". arguments.max(x) returns the index of the greatest element of x others for reading tab-delimited files which. is.ncol=) matrix. rep(c(1. sep is the character separator between arguments Indexing lists by Tom Short. seq(along=x) generates 1. hdf5.) in the XDR platform.search("topic") search the help system output.c=3i).. giving the widths of the fixed-width fields order: rev(sort(x)) save(file.. To read a table copied from Excel."myclass" tors. See www. Indexing vectors character or factor columns are surrounded by quotes (")..5” options(.dim=) array with data x. use col.start() start the HTML version of help x <. x$name id. See packages XML.. seq(from. as. for a complete list. x can be a list. length= Variable conversion digits. sep=" ") prints the arguments after coercing to Slicing and extracting data character. breaks is the number independent binary format of cut intervals or a vector of cut points save. data frames. cut(x. 1:4 + 1 is “2.null(x). widths sort(x) sorts the elements of x in increasing order.ch=c("a".. x[n] list with elements n Granted to the public domain.) set or examine many global options. use comment.data.frame(v=1:4.N. write. ..Rpad. dim(x) Retrieve or set the dimension of an object.. use each= to repeat “each” el- attach(x) database x to the R search path. of an object previously attached or a package. Input and output shorter vectors are recycled to the length of the longest list(."clipboard". Includes material from R for Beginners by Emmanuel Paradis (with format(x. Inc. NROW(x) is the same but treats a vector as a one- frame from it. class(x) get or set the class of x. use matrix(x. useful for for loops functions in package x. Smith Baggott & Short R Development Core Team R Reference Card cat(. D. elements of x recycle if x is not long enough nrow(x) number of rows.header=TRUE) id..which) get or set the attribute which of x help for options on row naming. attributes(obj) get or set the list of attributes of obj read. x["name"] element named "name" ?topic id. x can be a name or character string data. Use search() to show the search path."c". use factor(x. and Data selection and manipulation read.) format an R object for pretty printing x[["name"]] element of the list named "name" permission).complex(x)."the")] elements in the given set the regular expression ”topic” "clipboard".names=NA to add a blank column header to get the column headers aligned correctly for spreadsheet input x[1:n] first n elements Most R functions have online documentation. x["name".. use methods(as) ement of x each times. pipes.2)..4.org for the source and latest ent methods for different objects x[[n]] nth element of the list version. zipped files..Essential web resources An Introduction to R R Reference Card 2. use methods(is) load() load the datasets written with save length(x) number of elements in x list(a=c(1... specify dimensions like dimnames(x) Retrieve or set the dimension names of an object read.. as.array(x).header=TRUE) id.j] column j generic meaning it has different operations for different classes of a For database interaction. data frame.frame’.3)] columns 1 and 3 ls() show objects in the search path. vector... specify pat="pat" to search on a ROracle. This can often be a charac. eol is the end-of-line separator.. dim(x) <.0 W. Venables.read.delim("filename".. k is the number of levels. [email protected].. file="" means the standard input or x[x > 3] all elements greater than 3 help... x[x > 3 & x < 5] all elements between 3 and 5 apropos("topic") the names of all objects in the search list matching On windows.levels=) encodes a vector x as a factor ncol(x) and NCOL(x) id.2)..is=TRUE to prevent character vectors from being converted to fac- gl(n.frame(x). but with defaults set for tors or factors reading comma-delimited files rbind(.complex(x).3).) prints its arguments.character(x). file="".c(1.) id. sep=" ") prints x after converting to a data frame. ter string naming a file or a connection.min(x) returns the index of the smallest element of x cbind(. Connections can include files. common ones: width.] row named "name" pattern ls.header=FALSE.. EPRI Solutions.3). Introductory texts R in a Nutshell: A Desktop A Beginner’s Guide to R Quick Reference Zuur. Ieno. 2009 Both texts available online through UW library Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 12 / 53 . 2009 O’Reilly Media. Meesters Joseph Adler Springer. Introductory texts R in Action The Art of R Programming Robert Kabacoff Norman Matloff Manning Publications.ÊÜˆÌ…Ê É ³³Ê>˜`Ê*Þ̅œ˜ÊvœÀʈ˜VÀi>Ãi`Ê ART OF R UÊ ˆ˜`ʘiÜÊ«>VŽ>}iÃÊvœÀÊÌiÝÌÊ>˜>ÞÈÃ]ʈ“>}iʓ>˜ˆ«Õ> PROGR A MMING A TOUR O F S TAT I S T I C A L S O F T W A R E D E S I G N UÊ -µÕ>ÅÊ>˜˜œÞˆ˜}ÊLÕ}ÃÊ܈̅Ê>`Û>˜Vi`Ê`iLÕ}}ˆ˜}Ê 7…i̅iÀÊޜսÀiÊ`iÈ}˜ˆ˜}Ê>ˆÀVÀ>vÌ]ÊvœÀiV>Ã̈˜}Ê̅iÊ NORMAN MATLOFF œvÊ >ˆvœÀ˜ˆ>]Ê. 2011 THE UÊ ˜ÌiÀv>ViÊ. 2011 No Starch Press. Ê>˜`Ê Ê­ œÊ-Ì>ÀV…Ê*ÀiÃî° Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 13 / 53 .>ۈðʈÃÊÀiÃi>ÀV…ʈ˜ÌiÀiÃÌÃʈ˜VÕ`iÊ UÊ Ài>ÌiÊ>ÀÌvՏÊ}À>«…ÃÊ̜ÊۈÃÕ>ˆâiÊVœ“«iÝÊ`>Ì>ÊÃiÌÃÊ œ˜ÊÜvÌÜ>ÀiÊ`iÛiœ«“i˜Ì°Êiʅ>ÃÊÜÀˆÌÌi˜Ê>À̈ViÃÊvœÀÊ UÊ 7ÀˆÌiʓœÀiÊivvˆVˆi˜ÌÊVœ`iÊÕȘ}Ê«>À>iÊ. 2002 Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 14 / 53 . Dalgaard Venables and Ripley Springer.Statistics with R Introductory Statistics with R Modern Applied Statistics 2nd Edition with S. 4th Edition P. 2008 Springer. Robert Muenchen has written R books for this audience: http://r4stats. SPSS.edu/~hiebeler/comp/matlabR.umaine. or Stata.Experience with other statistical computing languages For those with experience in MATLAB.math.com Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 15 / 53 .pdf For those with experience in SAS. David Hiebeler has created a MATLAB/R cross reference document: http://www. Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 16 / 53 . Interacting with R R is an interpreted language† An R interpreter must be running in order to evaluate R commands or execute R scripts RGui which includes an R Console window RStudio which includes an R Console window † http://en.wikipedia.org/wiki/Interpreted_language Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 17 / 53 . R expression evaluation R expressions are processed via R’s Read-eval-print loop † : † http://en.org/wiki/Read-eval-print_loop Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 18 / 53 .wikipedia. Interacting with the RGui The RGui is an interactive command driven environment: Type R commands (expressions) into the R Console Copy/Paste multiple R commands into the R Console Source an R script An R script is simply a text file of multiple R commands Commands entered interactively into the R console Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 19 / 53 . Interacting with RStudio The RStudio is an Integrated Development Environment (IDE) R: Embedded R Console RStudio runs an R interpreter automatically Program editor for R Plot window File browser RStudio includes an embedded R Console Integrated version control R debugger Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 20 / 53 . org/wiki/Functional_programming Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 21 / 53 .Calling functions sin(pi/2) R makes extensive use of functions† ## [1] 1 Functions can be defined to take print("Hello.95136313 arguments the parentheses are required date() ## [1] "Sun Aug 31 17:08:42 2014" † http://en. world" Functions typically return a value a return value is not required abs(-8) Functions are called by name with ## [1] 8 any arguments enclosed in cos(2*sqrt(2)) parentheses even if the function has no ## [1] -0. world") zero or more arguments ## [1] "Hello.wikipedia. 7183) e Variables are typically assigned ## [1] 2.5 y Like other programming languages.0020828847 s*e+y ## [1] 8.rnorm(n=2) r arguments in a function call ## [1] -1.0067110533 -0.2. s assignment function: assign ## [1] 1.8442567 Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 22 / 53 .Assigning values to variables y <. ## [1] 5 values can be stored in variables assign("e".4142136 equal sign: = must be used to assign r <.7183 in 1 of 3 ways: s = sqrt(2) assignment operator: <. c("Seattle"."airport").org/wiki/Object-oriented_programming Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 23 / 53 .2."San Francisco") ls() ## [1] "cities" "e" "filename" "m" "r" "s" ## [7] "tab" "x" "y" † http://en.data.Object orientation in R Everything in R is an Object† Use functions ls and objects to list all objects in the current workspace x <.frame(store=c("downtown".matrix(rnorm(9).1416.24)) cities <."eastside".sales=c(32.wikipedia.17.c(3.nrow=3) tab <."Portland".7183) m <. 1] [.] 0.Object classes m All R objects have a class ## [.] -0.] 0.96472235 do with it class(m) Use function class to ## [1] "matrix" display an object’s class tab There are many R classes.790144078 0.2] [.19904931 ## [3.071532765 -0.3] The class of an object determines ## [1.012603635 1.262264339 -0.73778598 what it can do and what you can ## [2.586864810 -0. ## store sales basic classes are: ## 1 downtown 32 numeric ## 2 eastside 17 character ## 3 airport 24 data.frame class(tab) matrix ## [1] "data.374352397 0.frame" Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 24 / 53 . 1622777 † http://en. 3.vector <.0000000 1. 7. the combine function most places where single value can be supplied. a vector can be supplied and R will perform a vectorized operation my.vector) ## [1] 1.wikipedia.7320508 2.4142136 2. 10) my.c(2.6457513 3. 4.Vectors R is a vector/matrix programming language (also know as an array programming language† ) vectors can easily be created with c.org/wiki/Array_programming Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 25 / 53 .vector ## [1] 2 4 3 7 10 my.vector^2 ## [1] 4 16 9 49 100 sqrt(my. numeric vectors.2.7183."golden") my.6180 The [1] in the above output is labeling the first element of the vector The c function can be used to create character vectors.6180 my.c("pi".c(3."euler".6180) constants ## [1] 3.labels <. as well as other types of vectors Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 26 / 53 .1.4142 1.labels constants ## pi euler sqrt2 golden ## 3.4142.7183 1.1.7183 1.Creating vectors with the c function constants <.my.1416 2.labels ## [1] "pi" "euler" "sqrt2" "golden" names(constants) <.1416 2.1416.4142 1."sqrt2". 6180 Vectors can be indexed in any of the following ways: constants[c("pi".1416 1.4142 1.Indexing vectors constants[c(1.6180 vector of negative integers constants > 2 vector of named items logical vector ## ## pi TRUE euler TRUE sqrt2 golden FALSE FALSE constants[constants > 2] ## pi euler ## 3.6180 Vectors indices are placed with constants[c(-1.7183 Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 27 / 53 .4142 1.4)] ## pi sqrt2 golden ## 3.3.1416 1.-2)] square brackets: [] ## sqrt2 golden ## 1."golden")] vector of positive integers ## pi golden ## 3.1416 2. matrices.frames etc. 1:5 ## [1] 1 2 3 4 5 -(1:4) ## [1] -1 -2 -3 -4 letters[1:15] ## [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" letters[16:26] ## [1] "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" letters[-(1:15)] ## [1] "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 28 / 53 .Creating integer sequences with the a:b operator The sequence operator will generate a vector of integers between a and b Sequences of this type are particularly useful for indexing vectors. data. 4226886 4.4226886 4.log(x[i]) y ## [1] 4.27.4083034 4.87.5662214 4.Comparing vector and non-vector computing # vectorized operation # taking the log of each element in a vector x <.78.4218481 4.96.85.length(x) y <.5836401 4.39.4461745 4.4550447 ## [8] 4.4083034 4.4793802 4.4550447 ## [8] 4.83.82.4218481 4.4588719 4.4793802 4.86.06.3636080 Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 29 / 53 .88.c(97.5086593 4.86.83.5538769 4.18.5662214 4.4588719 4.18.32.95.5836401 4.3.4100065 4.13.3636080 # non-vectorized computation # taking the log of each element in a vector n <.4100065 4.25.n) for( i in 1:n ) y[i] <.82.5086593 4.5538769 4.4461745 4.90.54) log(x) ## [1] 4.8.rep(0. 4.1] [.2] [.] 81 25 1 ## [3.7.j]^2 y ## [.Comparing vector and non-vector computing # vectorized operation # taking the log of each element in a matrix x <.] 16 9 64 # non-vectorized computation # taking the log of each element in a matrix y <.] 16 9 64 Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 30 / 53 .3] ## [1.3] ## [1.matrix(c(2.6.] 4 49 36 ## [2.9.j] <.x[i.1] [.1.5.8).] 4 49 36 ## [2.nrow=3) x^2 ## [.2] [.] 81 25 1 ## [3.3.x for( i in 1:nrow(x) ) for( j in 1:ncol(x) ) y[i. Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 31 / 53 . html' yourself Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 32 / 53 .start() ## If nothing happens.The HTML help system R has a comprehensive Html help facility Run the help.0. you should open ## 'http://127.0.start function R GUI menu item Help|Html help help.1:28913/doc/html/index. The help function Obtain help on a particular topic via the help function help(topic) ?topic help(read.table) Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 33 / 53 . search function help.The help.search function Search help for a particular topic via the help.search(topic) ??topic ??predict Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 34 / 53 . Help tab in RStudio RStudio incorporates a dedicated help tab which facilitates accessing the R Html help system Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 35 / 53 . Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 36 / 53 . org List of CRAN mirror sites Manuals FAQs Site seach Mailing lists Links Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 37 / 53 .R Homepage http://www.r-project. CRAN .Comprehensive R Archive Network http://cran.org CRAN Mirrors About 45 countries About 100 sites worldwide About 15 sites in US R Binaries R Packages 5800+ packages R Sources Task Views use your closest CRAN mirror site Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 38 / 53 .fhcrc. CRAN Task Views Organizes the 5800+ R packages by application Finance Time Series Econometrics Optimization Machine Learning Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 39 / 53 . com/ Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 40 / 53 .Stackoverflow Stackoverflow has become the primary resource for help with R http://stackoverflow. ethz.R-SIG-FINANCE Nerve center of the R finance community Daily must read Exclusively for Finance-specific questions. not general R questions https://stat.ch/mailman/listinfo/r-sig-finance Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 41 / 53 . googlecode.Google’s R Style Guide Naming convention Coding Syntax Program Organization http://google-styleguide.html Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 42 / 53 .com/svn/trunk/google-r-style. net Introductory R Lessons R Interface Data Input Data Management Basic Statistics Advanced Statistics Basic Graphs Advanced Graphs Site maintained by Robert Kabacoff.Quick R http://www.statmethods. author of R in Action Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 43 / 53 . and other tech notes Site of Earl Glynn of Stowers Institute for Medical Research R Graphics and other useful information R Color Chart Using Color in R (great presentation) Plot area.org/efg/R/index. multiple figures Mixture models Distance measures and clustering Using Windows Explorer to Start R with Specified Working Directory (under tech notes) http://research.stowers-institute.htm Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 44 / 53 .R graphics details. margins. colors. Programming in R Online R programming manual from UC Riverside: R Basics Finding Help Code Editors for R Control Structures Functions Object Oriented Programming Building R Packages http://manuals.ucr.edu/home/programming-in-r Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 45 / 53 .bioinformatics. vignettes.upenn.psych.org Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 46 / 53 .edu/search.inside-r.org/ Revolution Blog Blog from David Smith of Revolution http://blog.html R Seek R specific search site http://www.rseek. R-help http://finzi.Other useful R sites R Bloggers Aggregation of about 550 R blogs http://www.revolutionanalytics.com Inside-R R community site by Revolution Analytics http://www.com R Site Search Search R function help.r-bloggers. Outline 1 R language overview and history 2 R language references 3 Short R Tutorial 4 The R help system 5 Web resources for R 6 IDE editors for R Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 47 / 53 . RStudio RStudio is a fully-featured open-source IDE for R R language highlighting Paste/Source to R console object explorer tabbed graphics window integrated version control 1-click kintr/Sweave compilation RStudio also provides a server-based version (R running in the cloud) Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 48 / 53 . Revolution R Enterprize Visual Development Environment Revolution Analytics is a company that sells a commercial distribution of R including a desktop IDE Revolution R Enterprize is free to academic users R language highlighting Paste/Source code to R Source code debugger object explorer runs R in SDI mode http://www.com Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 49 / 53 .revolutionanalytics. an excellent shareware editor with support for LATEX and Sweave development R language highlighting Paste/Source code to R 1-click Sweave compilation Supports R in MDI mode Paste/Source code to S-PLUS http://www.winedt.com http://www.org/Config/modes/R-Sweave.php Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 50 / 53 .winedt.WinEdt and R-Sweave Based on WinEdt. walware.An Eclipse Plug-In for R StatET is a plug-in for the open-source Eclipse development environment R language highlighting Paste/Source code to R Source code debugger 1-click Sweave compilation Supports R in SDI mode Excellent documentation by Longhow Lam http://www.StatET .de/goto/statet Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 51 / 53 . org http://sourceforge.net/projects/npptor Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 52 / 53 .Notepad++ and NpptoR NpptoR is an automation widget (based on AuotHotkey) which allows the very useful program editor Notepad++ to interact with R R language highlighting Paste/Source code to R Supports R in SDI mode http://notepad-plus-plus. washington.Computational Finance and Risk Management http://depts.edu/compfin Guy Yollin (Copyright © 2014) R Programming for Quantitative Finance R Basics 53 / 53 .
Copyright © 2024 DOKUMEN.SITE Inc.