3.1. The data frame survey contains the results of a survey of 237 firstyear Statistics students at...
Question:
3.1. The data frame survey contains the results of a survey of 237 firstyear Statistics students at Adelaide University. For a graphical summary of all the variables, use plot (survey) . Note that this produces a dotchart for factor variables, and a normal scores plot for the numeric variables.
One component of this data frame, Exer, is a factor object containing the responses to a question asking how often the students exercised. Produce a barchart of these responses. Use table and pie to create a pie chart of the responses. Do you like this better than the bar plot? Which is more informative?
Which gives a better picture of exercise habits of students? The pie function takes an argument names which can be used to put labels on each pie slice.
Redraw the pie chart with labels. Alternatively, you could add a legend to identify the slices.
You might like to try the same things with the Smoke variable, which records responses to the question "How often do you smoke?" Note that table and levels ignore missing values; if you wish to include non-respondents in your chart use summary to generate the values, and names on the summary object to generate the labels.
Step by Step Answer:
Modern Applied Statistics With S-Plus
ISBN: 9781489928191
1st Edition
Authors: W. N. Venables, B. D. Ripley