For this lab, you will use R Markdown and knitr to recreate this report. Your lab only needs to include the header (above this paragraph) and the numbered sections below starting with Introduction. You will need the diabetes dataset from lab 8 and the tab_diab object from Homework 1.

Instructions:

  1. Create a header with title, subtitle, author, and date
  2. Change the options for the html_document output to allow figure captions, numbered sections, and a table of contents. Additionally, change the theme to cosmo.
  3. In a code chunk, set global knitr options and load all the packages you need.
  4. In a code chunk, read in your dataset diabetes.csv and read the chunks for the two external files exfile1.R and exfile2.R.
  5. Use the information in exfile1.R and exfile2.R to bring in the chunks corresponding to the Tables and Figure. Note: you should not have any R code written in this file in the Tables and Figure section.
  6. Set up the Introduction, Tables, and Figure sections.
  7. Set up the Function section. Hint: In the file exfile1.R, I’ve created an R object called cat1. Use in-line text to include this picture in the output file.

1 Introduction

The diabetes dataset has 403 observations and 20 variables. In this report, we create:

  1. A table displaying means and number of observations for the diabetes dataset as in Homework 1.

  2. A table displaying the odds ratios for the diabetes dataset as in Lab 8.

  3. A plot displaying the odds ratios from Table 2 and corresponding 95% confidence intervals.

2 Tables

Table 1. Summary statistics
Variable Mean N_diabetic Mean_diabetic N_not_diabetic
chol 207.85 60 228.60 329
hdl 50.45 60 45.28 329
age 46.85 60 58.40 330
height 66.02 59 66.17 326
weight 177.59 59 192.71 330
Table 2. Odds ratios
Variable OR p-value LB UB
chol 1.01 0.00 1.00 1.02
hdl 0.98 0.02 0.96 1.00
age 1.06 0.00 1.04 1.08
weight 1.01 0.01 1.00 1.02
height 1.01 0.77 0.93 1.10

3 Figure

Figure 1. Associations between covariates and diabetes

Figure 1. Associations between covariates and diabetes

4 Functions

Cute cat function courtesy of Scott Chamberlain http://rforcats.net/.