Package Loading

library(here)
library(magrittr)
library(janitor)

# add other packages here as desired

library(tidyverse)

Import the hbp3456 Data

This template assumes that you’ve placed the hbp3456.csv data set in a sub-folder called data beneath the lab01 project directory you’re using in R Studio.

lab01 <- read_csv(here("data", "hbp3456.csv")) %>%
    mutate(record = as.character(record))

lab01
# A tibble: 3,456 x 23
   record practice provider   age race  eth_hisp sex   insurance income hsgrad
   <chr>  <chr>    <chr>    <dbl> <chr> <chr>    <chr> <chr>      <dbl>  <dbl>
 1 900018 Walnut   W_05        64 <NA>  <NA>     F     Medicare   15600   83  
 2 900024 King     K_07        74 AA_B~ No       F     Medicare   16200   92.8
 3 900037 Sycamore S_06        60 AA_B~ No       F     Commerci~  21400   79  
 4 900043 Highland H_07        46 White Yes      F     Medicaid   38300   83.5
 5 900057 Sycamore S_04        59 AA_B~ No       M     Commerci~  23200   78.7
 6 900062 Elm      E_03        54 AA_B~ No       M     Commerci~  48600   85.5
 7 900076 Plympton P_03        74 White No       M     Commerci~  64200   92.9
 8 900082 Elm      E_06        73 White No       M     Medicare   48600   85.5
 9 900097 Sycamore S_10        58 AA_B~ No       F     Commerci~  29900   86.2
10 900101 Center   C_01        46 AA_B~ No       M     Uninsured  63600   97.5
# ... with 3,446 more rows, and 13 more variables: tobacco <chr>,
#   depr_diag <chr>, height <dbl>, weight <dbl>, ldl <dbl>, statin <chr>,
#   bp_med <chr>, sbp <dbl>, dbp <dbl>, visits_1 <dbl>, visits_2 <dbl>,
#   acearb <chr>, betab <chr>

Verifying a Clean Load

Please feel free to use this section in checking your work, but it is not required in your submission, so it can be deleted. If you use some alternate approach to ingest the data, you might want to verify that the sum of the ages matches the sum it should be.

lab01 %>% summarize(sum(age))
# A tibble: 1 x 1
  `sum(age)`
       <dbl>
1     204556

You might also check that you have the same distribution of race values as I show below.

lab01 %>% tabyl(race)
     race    n    percent valid_percent
 AA_Black 1460 0.42245370    0.43400713
    Asian   53 0.01533565    0.01575505
    Other  109 0.03153935    0.03240190
    White 1742 0.50405093    0.51783591
     <NA>   92 0.02662037            NA

A more complete summary of the data is available in the instructions for this Lab if you want to check something else.

1 Question 1

Place your response to Question 1 here.

2 Question 2

Place your response to Question 2 here.

3 Question 3

Place your response to Question 3 here.

4 Question 4

Place your response to Question 4 here. This will likely use the sentence suggested in the instructions.

5 Question 5

Place your response to Question 5 here, which should just be “My github name is …”.

Session Information

xfun::session_info()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Locale:
  LC_COLLATE=English_United States.1252 
  LC_CTYPE=English_United States.1252   
  LC_MONETARY=English_United States.1252
  LC_NUMERIC=C                          
  LC_TIME=English_United States.1252    

Package version:
  askpass_1.1        assertthat_0.2.1   backports_1.2.1   
  base64enc_0.1.3    BH_1.75.0.0        blob_1.2.1        
  brio_1.1.1         broom_0.7.3        callr_3.5.1       
  cellranger_1.1.0   cli_2.2.0          clipr_0.7.1       
  colorspace_2.0-0   compiler_4.0.3     cpp11_0.2.5       
  crayon_1.3.4       curl_4.3           DBI_1.1.1         
  dbplyr_2.0.0       desc_1.2.0         diffobj_0.3.3     
  digest_0.6.27      dplyr_1.0.3        ellipsis_0.3.1    
  evaluate_0.14      fansi_0.4.2        farver_2.0.3      
  forcats_0.5.0      fs_1.5.0           generics_0.1.0    
  ggplot2_3.3.3      glue_1.4.2         graphics_4.0.3    
  grDevices_4.0.3    grid_4.0.3         gtable_0.3.0      
  haven_2.3.1        here_1.0.1         highr_0.8         
  hms_1.0.0          htmltools_0.5.0    httr_1.4.2        
  isoband_0.2.3      janitor_2.1.0      jsonlite_1.7.2    
  knitr_1.30         labeling_0.4.2     lattice_0.20.41   
  lifecycle_0.2.0    lubridate_1.7.9.2  magrittr_2.0.1    
  markdown_1.1       MASS_7.3.53        Matrix_1.2.18     
  methods_4.0.3      mgcv_1.8.33        mime_0.9          
  modelr_0.1.8       munsell_0.5.0      nlme_3.1.149      
  openssl_1.4.3      pillar_1.4.7       pkgbuild_1.2.0    
  pkgconfig_2.0.3    pkgload_1.1.0      praise_1.0.0      
  prettyunits_1.1.1  processx_3.4.5     progress_1.2.2    
  ps_1.5.0           purrr_0.3.4        R6_2.5.0          
  RColorBrewer_1.1.2 Rcpp_1.0.6         readr_1.4.0       
  readxl_1.3.1       rematch_1.0.1      rematch2_2.1.2    
  reprex_0.3.0       rlang_0.4.9        rmarkdown_2.6     
  rprojroot_2.0.2    rstudioapi_0.13    rvest_0.3.6       
  scales_1.1.1       selectr_0.4.2      snakecase_0.11.0  
  splines_4.0.3      stats_4.0.3        stringi_1.5.3     
  stringr_1.4.0      sys_3.4            testthat_3.0.1    
  tibble_3.0.5       tidyr_1.1.2        tidyselect_1.1.0  
  tidyverse_1.3.0    tinytex_0.29       tools_4.0.3       
  utf8_1.1.4         utils_4.0.3        vctrs_0.3.6       
  viridisLite_0.3.0  waldo_0.2.3        whisker_0.4       
  withr_2.4.0        xfun_0.19          xml2_1.3.2        
  yaml_2.2.1