Introduction to R

Introduction to R and

Exploratory Data Analysis

September 3, 2010

Introduction to RandExploratory Data Analysis ? p. 1/2

Agent Orange

Agent Orange is an herbicide mixture used during the Vietnam War to destroy forest cover/vegetation. Agent Orange, so-called from the orange color of its storage drums, contains trace amounts of the highly toxic impurity dioxin.

Agent Orange has been linked to cancers and other diseases in several epidemiological studies. Dioxin has been shown to cause a variety of illnesses in lab animals.

About 3 million Americans served in the armed forces in Vietnam during the Vietnam War. The Operation Ranch Hand mission involved spraying 20 million gallons of Agent Orange over 3.6 million acres of Vietnamese land.

Introduction to RandExploratory Data Analysis ? p. 2/2

Retrospective Study (CDC 1987)

sample (nonrandom) of 646 Vietnam vets who served during 1967-1968 sample (nonrandom) of 97 vets who served in the US and Germany between 1965-1971 Dioxin concentrations (parts per trillion) taken from blood serum in 1987 as a biological marker for previous Agent Orange exposure

Data from the CDC report published in JAMA 260:1249-54. See also CDC report



Introduction to RandExploratory Data Analysis ? p. 3/2

Creating a Dataframe in R

> vets = read.table("case0302.csv", header=T, sep=",")

> names(vets) [1] "DIOXIN" "VETERAN"

Notes: 1. header=T tells R that the first line of the file contains

variable names 2. sep="," tells R that columns of data are separated

by a comma (the csv format) 3. the names function extracts the names of variables in

a dataframe

Introduction to RandExploratory Data Analysis ? p. 4/2

Reading Data

read.csv Comma separated variable format read.fwf Fixed width format read.delim Tab delimited files See help(read.table) for options, such as setting character for NAs, column separators, skipping lines, etc See also scan() for reading in large files

Introduction to RandExploratory Data Analysis ? p. 5/2

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download