Introduction to Statistical Analysis Using R

Introduction to Statistical Analysis Using R

Introduction to Statistical Analysis Using R Nick, Caroline, Tanya What is R? R is a programming language for data analysis and graphics All information about R is found on http://www.R-project.org R system contains two major components:

1.Base system contains the R language software and the high priority add-on packages listed on pg.3 2.User contributed add-on packages Who uses R? All scientists especially those working in developing countries It allows universal free access to state of the art tools for statistical data analysis

Most widely used for teaching undergraduates and graduates statistics b/c the students can use it free of cost Installing RBase System 1. Go to http://CRAN.R-project.org 2. Choose your computer from the list (Linux, MacOS X, or Windows) 3. Click on Base (Base or Contrib) 4. Click on R-2.6.1-win32.exe

5. Save R Getting Started Changing prompt - pg.3 Example using R as a pocket calculator pg.3 Storing vs. Printing R is not space sensitive, but it is case sensitive

Getting Help in R The Help system is a collection of manual pages describing each function and data set that comes with R Help/manual page is shown when the name of the function we would like to get help for is supplied to the help function Ex. help(mean) or help(mean) or ?mean Installing add-on packages

All packages are available on: http://CRAN.R-project.org/src/contrib/PA CKAGES.html Pick package from list and download To install add-on package:

1. install.packages(package name) 2. library(package name) Forbes2000 Example Go to http://CRAN.R-project.org/src/contrib/PACKAGE S.html and select HSAUR from the list Choose what pertains to your computer ex. Windows binary HSAUR 1.2-1.zip Save to desktop

Find Forbes2000 list in rawdata folder Install in R : install.package(HSAUR) library(HSAUR) Working with Data Sets Ex. Forbes 2000 list Vector elementary structure for data handling in R; set of simple elements, all being objects of the same class Ex. First 3 companies in Forbes - Forbes2000[,"name"]

[1:3] Variable names headings names(Forbes2000) Finding structures of data set useful for large data sets str(Forbes2000) Dimensions dim(Forbes2000) nrow(Forbes2000) ncol(Forbes2000)

Simple Summary Statistics Mean mean(Forbes2000 [,sales]) Median median(Forbes2000 [,assets]) Range range(Forbes2000 [,sales]) Importing Data Not Part of a Package When is this used? Most data sets are not part of a down-loadable package

Most people need to import their own data sets into R Example Airport data (download to Desktop) In R: File Change Dir Desktop OK name given < - read.table (airport.csv, header = TRUE, sep = ,, row.names =1 Making a Graph Graph of Rank of airport vs. Shop

Plot (Rank ~ Shop, data = name given, pch =O) Homework Change Prompt > to R>

Import Airport Data Set from Excel Print data set in R Find the Dimensions, the number of Columns, and the number of Rows in the data set Find structure of data set Find median of category Shop Find mean of Domestic Contact info Tanya [email protected]

Caroline [email protected] Nick [email protected]

Recently Viewed Presentations

  • Analog Circuit Design - IIT Kanpur

    Analog Circuit Design - IIT Kanpur

    In op-amp circuits employing negative feedback, the voltage at the positive input terminal is almost equal to the voltage at the negative input terminal, given that the gain of the op-amp is very high. ... Golden Rules for Analysing Op-Amp...
  • Existential Psychotherapies EXISTENTIAL APPROACHES  Way of thinking about

    Existential Psychotherapies EXISTENTIAL APPROACHES Way of thinking about

    Existential Psychotherapies * Contact and Resistance to Contact CONTACT To interact openly with environment w/o losing one's individuality Requires contact/awareness of one-self RESISTANCE TO CONTACT Defenses that prevent experiencing the present fully Defenses: used to control the environment rather than...
  • Anchorage Estate Planning CouncilSeptember 24, 2012

    Anchorage Estate Planning CouncilSeptember 24, 2012

    The Current GST Exemption: $5.12 million. If the GST Exemption Sunsets: The generation-skipping exemption generally tracks the $1,000,000 applicable exclusion, but it is subject to an inflation adjustment. Therefore, the 2013 GST exemption will be approximately $1,430,000. Any GST transfer...
  • Scanning Electron Microscopy in Rabbit Corneas with Intrastromal

    Scanning Electron Microscopy in Rabbit Corneas with Intrastromal

    Scanning Electron Microscopy in Rabbit Corneas with Intrastromal Corneal Segment(ICS) Eduardo Andreghetti(1) Maria Rosa Bet Moraes Silva(2) Maria Aparecida Domingues(3)
  • France takes over Indochina - Issaquah Connect

    France takes over Indochina - Issaquah Connect

    Essentially calledattention to fundamental shortcomings in the American approach to warfare in Southeast Asia. Some conservative revisionists insist that real benefits accrued to the non-Communist nations of Southeast Asia as a result of U.S. intervention, and argued that the "pacification"...
  • Chondrogenic Differentiation of hMSCs on PCL Nanofibers

    Chondrogenic Differentiation of hMSCs on PCL Nanofibers

    Chondrogenic Differentiation of hMSCs on PCL Nanofibers Winnie Kuo University of California, Berkeley ... chondrogenic cells produced high amounts of sGAG Oblong chondrogenic cell shape resembles superficial layer of articular cartilage Future Directions hMSCs cultured on nanofibers as an ...
  • Balancing Nationalism &amp; Sectionalism

    Balancing Nationalism & Sectionalism

    Warm Up - September 11 Answer the following questions on a post it: 1. Which constitution do you think was written first - state or federal?
  • Group 4 - digitalteachers.co.ug

    Group 4 - digitalteachers.co.ug

    Laboratory preparation of hydrogen peroxide. ... Sulphur reacts with concentrated solutions of alkalis to form a sulphide and a sulphite which reacts with more sulphur to form poly sulphides and thiosulphate respectively. 3S (s) + 6OH- (aq) →