1 / 16

Introduction to R project

Introduction to R project. Marek Majdan. R project. Statistical computing environment and software Absolutely free Updated by statisticians Very powerfull Basically unlimited capability. R project - principle. Editor. R Engine. SCRIPT. Graphical Output. Numerical output.

chloe
Download Presentation

Introduction to R project

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. Introduction to R project Marek Majdan Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  2. R project • Statistical computing environment and software • Absolutely free • Updated by statisticians • Very powerfull • Basically unlimited capability Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  3. R project - principle Editor R Engine SCRIPT Graphical Output Numerical output Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  4. Script example library (RODBC) library(foreign) library(Hmisc) library(Design) library(graphics) barb <- sqlFetch(odbcConnectExcel("d:/barb_data_new.xls"), sqtable = "data", na.strings = "NA", as.is = T) summary(barb) describe(barb) describe(barb$barb_group) ##normality tests shapiro.test(barb$AGE_CORRECTED) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  5. Packages • Base package • Contributed packages - specific functions written for specific purposes - not included in the base package - can be installed any time Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  6. R EDITOR NUMERICAL OUTPUT GRAPHICAL OUTPUT Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  7. Installing R Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  8. Installing R Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  9. Installing Packages 1. 3. 2. Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  10. Writing scripts • Every package contains ‘functions’ for performing various operations with data • Every function has a specific form and arguments needed • Every function has a specific output • An algorithm of functions to perform a specific sequence of actions is a script Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  11. Example I. • Function: library • To load a specific package • Form: library (name of package) library (Epicalc) library (Hmisc) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  12. Example II. • Function: plot • To plot a graph • Simple form: plot(x) • Complex form with a number of additional arguments: plot(x <- sort(rnorm(47)), type = "s", main = "plot(x, type = \"s\")") points(x, cex = .5, col = "dark red") Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  13. Important notes • Case sensitivity Plot ≠ plot ≠ PLOT • Avoid using punctuation and spaces in names of databases or variables (e.g. use ‘age_category’ instead ‘Age category’) Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  14. Importing data to R from Excel • Package: RODBC • Function: X=sqlFetch(odbcConnectExcel(“Y"),sqtable = “Z", na.strings = "NA", as.is = T) X=name of database in R after importing Y=path to excel file on disk Z=name of excel sheet Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  15. R commander • Graphical user interface (GUI) • Makes basic statistical computations simple but puts certain restrictions on R • Installing R commander: install package ‘Rcmdr’ using the standard package installing procedure • Function: library(Rcmdr) to start R commander Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

  16. R commander Training in essential biostatistics for Public Health Professionals in BiH, Marek Majdan, PhD; marekmajdan@gmail.com

More Related