3.15 Chapter 3 Review Questions 2

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

Data frame output
row State IQ Pres2008 Population College PhysicalActivity Smokers
1Alabama95.7McCain4.52537524.670.324.8
2Alaska99.0McCain0.65775529.279.424.9
3Arizona97.4McCain5.73987930.875.720.2
4Arkansas97.5McCain2.75000026.773.423.5
5California95.5Obama35.84203831.177.215.2
6Colorado101.6Obama4.60182138.081.219.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):

Data frame output
row Age Vitamin Calories Fat Fiber Alcohol Cholesterol Gender EverSmoke
16411298.857.06.30.0170.3FemaleFormer
27611032.550.115.80.075.8FemaleNever
33822372.383.619.114.1257.9FemaleFormer
44032449.597.526.50.5332.6FemaleFormer
57211952.182.616.20.0170.8FemaleNever
64031366.956.09.61.3154.6FemaleFormer
require(coursekata) # run your code here

Responses