4.15 Chapter 4 Review Questions 2

NutritionStudy 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

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

Now let's look at some data from the SleepStudy data frame. Here's the head() of the data frame, and then a description of the variables.

Data frame output
row Gender LarkOwl NumEarlyClass GPA ClassesMissed CognitionZscore PoorSleepQuality DepressionScore Stress Happiness AllNighter
10Neither03.600-0.2644normal280
20Neither23.2401.3961normal250
30Owl02.97120.381818normal170
40Lark53.7601.3991normal320
50Owl03.2041.2297normal150
61Neither03.500-0.04614high220
  • Gender 1=male, 0=female
  • LarkOwl Early riser or night owl? Lark, Owl, or Neither
  • NumEarlyClass Number of classes per week before 9am
  • GPA Grade point average (0-4 scale)
  • ClassesMissed Number of classes missed in a semester
  • CognitionZscore z-score on a test of cognitive skills
  • PoorSleepQuality Measure of sleep quality (higher values are poorer sleep)
  • DepressionScore Measure of degree of depression
  • Stress Coded stress score: normal or high
  • Happiness Measure of degree of happiness (higher values are happier)
  • AllNighter Had an all-nighter this semester? 0 or 1

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

Responses