day2 - # EXAMPLE 1 # # First download...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 ### EXAMPLE 1 ############################################################# # First download "heights.txt". # From the R file menu select "Change dir. ." to change the R working directory # to the folder that contains "heights.txt" heights=read.table("heights.txt",head=TRUE) #read in data names(heights) #check names of variables heights #look at entire dataset heights[1:15,] # look at first 15 rows of dataset heights$Mheight #look at only variable "Mheight" heights$Dheight #look at only variable "Dheight" attach(heights) #allow direct access to variable data Mheight #look at only variable "Mheight" Dheight #look at only variable "Dheight" hist(Mheight) #histogram for "Mheight" variable, R decides bin size hist(Mheight, breaks=c(20,40,60,80)) #histogram for "Mheight" variable, specify bin cut points hist(Mheight, breaks=c(50,54,58,62,66,70,74)) # different bins hist(Mheight, breaks=20) #histogram for "Mheight" variable, 20 bins of equal length hist(Mheight) #histogram for "Mheight" variable, R decides on bin size
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

day2 - # EXAMPLE 1 # # First download...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online