Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

police recoding #9

Open
chendaniely opened this issue Aug 17, 2018 · 1 comment
Open

police recoding #9

chendaniely opened this issue Aug 17, 2018 · 1 comment

Comments

@chendaniely
Copy link
Member

@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
Copy link
Collaborator

This is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants