brad-cannell / detect_fu_interviews_public

Public repository for the DETECT follow-up interviews.
0 stars 5 forks source link

Update code for observational measures #4

Closed m-gough closed 1 year ago

m-gough commented 1 year ago
mbcann01 commented 1 year ago

Thank you, @m-gough! I will take a look ASAP!

mbcann01 commented 1 year ago

Hi @m-gough!

First of all, I am so sorry for taking so long to review this pull request. I'm have been absolutely swamped lately. Second, I wrote a really long, detailed comment here, impulsively clicked on Files changed tab at the top of the screen, and then realized the the entire comment was deleted when I navigated way from this page! 🤦‍♂️😡 But, I will try my best to recreate it.

Overall

Overall, you a doing amazing work and I'm really grateful for your help! I do have a few comments that are meant to be constructive and not at all critical!

File names

YAML header

Loading packages

Spacing

Headers

Factors

self_report_recode_factor.Rmd

There is a lot of code like this:

self_report <- self_report %>%
  mutate(
    across(
      .cols = starts_with("neglect") & !ends_with("help") &
        !ends_with("reliable") & !ends_with("person"),
      .fns  = ~ case_when(
        .x == "Yes"        ~ 1,
        .x == "No"         ~ 2,
        .x == "Don't know" ~ 7,
        .x == "Refused"    ~ 9 
      ),
      .names = "{col}_4cat"
    ),
    across(
      .cols = starts_with("neglect") & !ends_with("help") &
        !ends_with("reliable") & !ends_with("person") & !ends_with("4cat"),
      .fn    = ~ factor(.x, levels = levels_yes_no),
      .names = "{col}_4cat_f"
    )
  )

Whichi is great code! But the column selection starts_with("neglect") & !ends_with("help") & !ends_with("reliable") & !ends_with("person") is pretty complex.

I think that's all I've got for now. Please let me know if you have any questions.

m-gough commented 1 year ago

Thank you so much for the feedback! I made the changes to the observational_measures data. I agree that the code in self_report was complicated, but I did data checks and it did work as expected. I will work on adding comments to that section of my code.

mbcann01 commented 1 year ago

Thank you, @m-gough!