# Start the browser to display the help routines help.start() # Find out what objects are in the workspace objects() # Return the value of the variable occ occ1 length(occ1) # Consider making a smooth curve instead of histogram hist(occ1) plot(density(occ1)) plot(density(occ2)) # Plut the curves on the same plot for comparison purposes # But notice the problem with the limits of the y - axis plot(density(occ1)) points(density(occ2),type = "l") # Determine the axis for the plot # Use color to distinguish the two curves # But what about the bandwidths? plot(density(occ1), ylim = c(0, 14)) points(density(occ2),type = "l", col="red") # Use the same bandwidth for both curves plot(density(occ1, bw=0.008), ylim= c(0, 14)) points(density(occ2, bw=0.008), type = "l", col= "red") # Another finsihing touch: make the line width of the curves thicker # so it is easier to see when displayed on the screen. plot(density(occ1, bw=0.008), lwd = 2, ylim=c(0, 14)) points(density(occ2, bw=0.008), type = "l", lwd = 2, col= "red") # The real data is on the web in a comma separated file # Read it into the object traffic traffic = read.csv("http://www.stat.berkeley.edu/users/rice/UCLA/flow-occ-table.txt",header=TRUE) names(traffic) summary(traffic) #Saving commands for future use history(max.show = Inf) savehistory(file="trafficIntro.R") #Saving variables for future use save(traffic, occ1, occ2, file="myTraffic.rda") load("myTraffic.rda")