3.15 Chapter 3 Review Questions 2

Here, again, is information on the USStates data frame.

       State    IQ Pres2008 Population College PhysicalActivity Smokers
1    Alabama  95.7   McCain   4.525375    24.6             70.3    24.8
2     Alaska  99.0   McCain   0.657755    29.2             79.4    24.9
3    Arizona  97.4   McCain   5.739879    30.8             75.7    20.2
4   Arkansas  97.5   McCain   2.750000    26.7             73.4    23.5
5 California  95.5    Obama  35.842038    31.1             77.2    15.2
6   Colorado 101.6    Obama   4.601821    38.0             81.2    19.8
  • State Name of state
  • IQ Mean IQ score of residents
  • Pres2008 Which 2008 Presidential candidate won state? M=McCain or O=Obama
  • Population Number of residents (in millions)
  • College Percentage of residents with college degrees
  • PhysicalActivity Percentage of residents who have competed in a physical activity in the past month
  • Smokers Percentage of residents who smoke

require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here
require(coursekata) # run your code here

The NutritionStudy data frame contains data for 315 patients at a hospital who had a noncancerous growth removed through surgery.  It includes the following variables:

  • ID ID number for each subject in this sample
  • Age Subject's age (in years)
  • Vitamin Vitamin use: 1=Regular, 2=Occasional, or 3=No
  • Calories Number of calories consumed per day
  • Fat Grams of fat consumed per day
  • Fiber Grams of fiber consumed per day
  • Alcohol Number of alcoholic drinks consumed per week
  • Cholesterol Cholesterol consumed per day, in mg
  • Gender Coded as Female or Male
  • EverSmoke Smoking status: Never, Former, or Current 

Here's the result from running head(NutritionStudy):

  Age Vitamin Calories  Fat Fiber Alcohol Cholesterol Gender EverSmoke
1  64       1   1298.8 57.0   6.3     0.0       170.3 Female    Former
2  76       1   1032.5 50.1  15.8     0.0        75.8 Female     Never
3  38       2   2372.3 83.6  19.1    14.1       257.9 Female    Former
4  40       3   2449.5 97.5  26.5     0.5       332.6 Female    Former
5  72       1   1952.1 82.6  16.2     0.0       170.8 Female     Never
6  40       3   1366.9 56.0   9.6     1.3       154.6 Female    Former
require(coursekata) # run your code here

Responses