bi-sdal / mitre

1 stars 0 forks source link

police recoding #9

Open chendaniely opened 6 years ago

chendaniely commented 6 years ago

@icrandell can you check to make sure the assumption I'm making is correct?

Run the below code and look at the ex_df and xe_df variables.

library(tibble)
# this is an example of the assumption i am making

# given this df as an example
ex_df <- tribble(
  ~report_no, ~child, ~adult, ~elderly, ~unknown, ~address,
  1,         1,      1,       1,        1,       'a',
  2,         2,      2,       2,        2,       'b',
  3,         3,      2,       1,        0,       'c'
)

# i give you back this

xe_df <- tribble(
  ~report_no, ~child, ~adult, ~elderly, ~unknown, ~address,
  1,         1,      0,       0,        0,       'a',
  1,         0,      1,       0,        0,       'a',
  1,         0,      0,       1,        0,       'a',
  1,         0,      0,       0,        1,       'a',
  2,         1,      0,       0,        0,       'b',
  2,         1,      0,       0,        0,       'b',
  2,         0,      1,       0,        0,       'b',
  2,         0,      1,       0,        0,       'b',
  2,         0,      0,       1,        0,       'b',
  2,         0,      0,       1,        0,       'b',
  2,         0,      0,       0,        1,       'b',
  2,         0,      0,       0,        1,       'b',
  3,         1,      0,       0,        0,       'c',
  3,         1,      0,       0,        0,       'c',
  3,         1,      0,       0,        0,       'c',
  3,         0,      1,       0,        0,       'c',
  3,         0,      1,       0,        0,       'c',
  3,         0,      0,       1,        0,       'c'
)
VT-iancrandell commented 6 years ago

This is correct.