Lab 2

John Fieberg

Objectives

Explore methods for visualizing data in R using

  • a data set collected from white-tailed deer in MN
  • a data set of your choice in either the Lock5Data or abd package

Plots

Single categorical predictor

  • pie chart (pie(tally(…)))
  • bargraph

Two categorical predictors

  • Frequency tables and the mosaic plot
  • Side-by-side bargraphs

Plots

Single quantitative variable

  • dotPlot
  • histogram
  • boxplot
  • densityplot

Mix of quantitative and categorical variables

  • side-by-side plots (histograms, boxplots)

Remember:

  • goal(y~x, data=mydata)

Variations:

  • goal(~x, data=mydata) for just one variable
  • goal(y~x|z, data=mydata) for a multipanel plot (for grouped data)
  • goal(y~x, color=~z, data=mydata) to map color to a third variable

For a few other variations, see this website!

Help files

Access with ?function name

Description Provides information about what the function does.

Usage gives examples of how you would use the function.

Arguments provides a list of options that you can supply to the function.

Details gives more information about how the function works.

Value tells you what is returned when you type the function.

Examples Examples illustrating the use of the code.