PDS Ch 3: Medical Records Assignment (slightly modified)

Although in your project you will be working with previously collected data, it is important to understand what data look like as well as how they are coded and entered into a spreadsheet for analysis.

Scenario: Imagine collecting medical records for 5 patients seeking treatment in a hospital emergency room. Points for each component are indicated in parentheses.

  1. (2 p) Select 4 variables recorded on the medical forms (one should be a unique identifier, at least one should be a quantitative variable and at least one should be a categorical variable).

  2. (1 p) Select a brief name (ideally 8 characters or less) for each variable.

  3. (2 p) Determine the variable type and the range of admissible (possible) values for recording each variable (create indicator codes as needed).

  4. (2 p) List the variable names, labels, types, and response codes in the code book area (can be a table or a list, as demonstrated above).

  5. (2 p) Enter data (that you make up) for each patient in the data table area (to meet your needs, you may need to reformat the provided table).

  6. (1 p) Compile this Rmd file to an html and upload to crowdgrader on Thursday (do not include your name, keep it anonymous).

Help: Look at “Help > Markdown quick reference” for how to make a table, and other formatting.

This is a template for the assignment.


Modify the table below. First, you may want to complete the codebook below, then return to fill in data.

v1 v2 v3
1 a x
2 b y
3 c z


At least three options, depending on what will work better for you.

Verbatim block

I think this is both the easiest and most practical strategy.

You can make a “verbatim” code block with your variables and values:

  variable 1
  0 = "type 1"
  1 = "type 2"
  variable 2
  [0, 120]

Bulletted list

You can make a bulletted list with your variables and values:

  • Var_1
    • variable 1
    • categorical
    • 0 = “type 1”
    • 1 = “type 2”
  • Var_2
    • variable 2
    • continuous
    • [0, 120]


You can make a table with your variables and values (but this is substantially harder to make and maintain than the verbatim block above):

Variable Label Type Values
Var_1 variable 1 categorical 0 = “type 1” 1 = “type 2”
Var_2 variable 2 continuous [0, 120]

Note. When formatting a table, the pipe symbol “|” separates columns, and the horizontal “-” line separates the header row from the data rows. The horizontal line designates how many columns the table has.

Note also that the table above has four columns in the first and last rows and five columns in the second row. You need at least as many columns defined in your horizontal line row as the maximum number of columns in any row. Basically, the number of columns defined in the horizontal line row is the number of columns that will display. If you’re missing columns for a certain row, this is probably the issue.