Load packages

Load data

1. Using the variable “sleptim1” and “marital” determine the following:

  • 1.1 Number of observations that are “NA” in the variable “sleptim1”;
# A tibble: 1 × 2
  sleptim1     n
     <int> <int>
1       NA  7387
  • 1.2 Number of observations having at most 5 hours of sleep;
[1] 52498
# A tibble: 2 × 2
  sleepnew                    count
  <chr>                       <int>
1 at most 5 hours of sleep    52498
2 more than 5 hours of sleep 431890
  • 1.3 Number of observations having more than 5 hours of sleep but less than 11 hours of sleep;
[1] 425670
# A tibble: 3 × 2
  sleepnew                                           count
  <chr>                                              <int>
1 at least 11 hours of sleep                          6220
2 at most 5 hours of sleep                           52498
3 more than 5 hours but less than 11 hours of sleep 425670
  • 1.4 Number of observations having at least 11 hours of sleep;
[1] 6220
# A tibble: 2 × 2
  sleepnew                     count
  <chr>                        <int>
1 at least 11 hours of sleep    6220
2 less than 11 hours of sleep 478168
  • 1.5 Number of observations having at most 5 hours of sleep that are married.
[1] 21417