#Histogram, boxplot, and scatterplot syntax

etwd("e:/rdir") #set working directory
data<-read.table("wg2.txt",header=T) #read a text file

hist(data$wg) #histogram for the variable wg
hist(data$hr) #histogram for the variable hr

boxplot(data$wg) #boxplot for the variable wg
plot(data$wg, data$hr) #scattergram for wg and hr variables

wg.f<- data[data$female==2,] #create a subset of data w/ only females
wg.m<-data[wg$female==1,] #create a subset of data w/ only males
boxplot(wg.m$wg, wg.f$wg) #two boxplots for males and females
boxplot(wg.m$wg, wg.f$wg) #two boxplots for males and females