3D. HISTOGRAMS
Again, we will work with the same data as before. Load the data HERE into a table named data. Name the columns subject, group, and rt.
Generating a histogram is very easy in R. Try the following:
hist(data$rt)
What you will see is a simply histogram like this.
Histograms provide an excellent representation of your data. For example, you could use something like the bar plot we generated a few exercises ago or you could show something like this:
hist(data$rt[data$group==1],col=rgb(1,0,0,0.5),ylim = c(0,25))
hist(data$rt[data$group==3],col=rgb(0,0,1,0.5),ylim = c(0,25),add=T)
Now this plot only overlays groups 1 and 3 but you get the idea - there is a lot more information here than a simple bar plot.
You can also pull information out of a histogram. Try:
stuff = hist(data$rt)
stuff
As with the boxplot command, you will see that the histogram generates a lot of statistical information.
For a list of all the properties of a histogram, use
?hist
Note, all of the classic plot properties such as titles, axis labels, and axis limits can be set.
Generating a histogram is very easy in R. Try the following:
hist(data$rt)
What you will see is a simply histogram like this.
Histograms provide an excellent representation of your data. For example, you could use something like the bar plot we generated a few exercises ago or you could show something like this:
hist(data$rt[data$group==1],col=rgb(1,0,0,0.5),ylim = c(0,25))
hist(data$rt[data$group==3],col=rgb(0,0,1,0.5),ylim = c(0,25),add=T)
Now this plot only overlays groups 1 and 3 but you get the idea - there is a lot more information here than a simple bar plot.
You can also pull information out of a histogram. Try:
stuff = hist(data$rt)
stuff
As with the boxplot command, you will see that the histogram generates a lot of statistical information.
For a list of all the properties of a histogram, use
?hist
Note, all of the classic plot properties such as titles, axis labels, and axis limits can be set.