1 / 15

Roger Barlow HEP Computing seminar 21 st February 2008

R. Roger Barlow HEP Computing seminar 21 st February 2008. What is R?. A data handling+graphics system with particular emphasis on statistical tools Compare and contrast: PAW, Root, Easyplot, Matlab…. Getting hold of R. Google ‘R download’ and follow instructions Quite painless

Download Presentation

Roger Barlow HEP Computing seminar 21 st February 2008

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. R Roger Barlow HEP Computing seminar 21st February 2008

  2. What is R? A data handling+graphics system with particular emphasis on statistical tools Compare and contrast: PAW, Root, Easyplot, Matlab…

  3. Getting hold of R Google ‘R download’ and follow instructions Quite painless Windows and unix versions exist

  4. Philosophy 1.1 The R environment R is an integrated suite of software facilities for data manipulation, calculation and graphical display. Among other things it has • an effective data handling and storage facility, • a suite of operators for calculations on arrays, in particular matrices, • a large, coherent, integrated collection of intermediate tools for data analysis, • graphical facilities for data analysis and display either directly at the computer or on hardcopy, and • a well developed, simple and effective programming language (called ‘S’) which includes conditionals, loops, user defined recursive functions and input and output facilities. (Indeed most of the system supplied functions are themselves written in the S language.) The term “environment” is intended to characterize it as a fully planned and coherent system, rather than an incremental accretion of very specific and inflexible tools, as is frequently the case with other data analysis software.

  5. What do you get? Help button Gives help And manuals Command line for entering instructions Screen where plots appear

  6. Example: simple stuff

  7. Assignment and vectors c means ‘concatenate’ Assignment operators

  8. Plotting

  9. Arguments Type help (“<whatever>”) Eg help(“rnorm”)

  10. More plotting

  11. Other plots

  12. Functions and scripts

  13. What was in the source file print("Loading Fourier routines") PIBY2<-asin(1); PI<-2*piby2; TWOPI=2*PI; ROOT2PI=sqrt(TWOPI) alternation<-function(n) {2*(seq(1:n) %% 2)- 1} fourier<-function(data,lo,hi) { nbins <- length(data) nn=round(nbins/2) W <- hi-lo delta <- W /nbins ii<-seq(1,nbins)-1 x<-delta*ii+lo theta<-x*twopi/W fc<-seq(1,nn) fs<-seq(1,nn) for(i in seq(1,nn)){ fc[i]<- sum(cos(i*theta)*data) fs[i]<- sum(sin(i*theta)*data) } fc[nn]=fc[nn]/2 fs[nn]=0 list(c=2*fc/nbins,s=2*fs/nbins, zero=sum(data)/nbins) }

  14. Files and stuff For hardcopy: >postscript(“<filename>”) >… plotting >dev.off() Also png(“<filename>”) and others File input >s=read.table(“<filename>") >print(s$V1) >plot(s$V1,s$V2) etc Or read.table(“<filename>”,HEADER=TRUE) And first line of file will be taken as names used instead of V1, V2…

  15. Interested? • Type demo() at the prompt

More Related