lemaslab / BEACH

The Breastfeeding and EArly Child Health (BEACH) Study
0 stars 4 forks source link

Dev activity: data_inventory() function created #11

Closed dlemas closed 4 years ago

dlemas commented 4 years ago

I created dev-activity branch to resolve issue #10. I ultimately created /utils directory with function called: data_inventory() that computes the necessary stats.

dlemas commented 4 years ago

@luran1 and @XinsongDu : I worked on this code over spring break. I have created a github issue/branch/pull request to outline how I think we should move forward. Please review the code, merge branch into master and test the code: data_inventory().

XinsongDu commented 4 years ago

Greetings Dr. Lemas:

Thank you for involving me to this pull request!

I was trying to test the code before merging to ensure that "master" branch will have no bug after merging. I found I encountered an error Error: Can't subset columns that don't exist. x The column "mompa_todays_date" doesn't exist. when running line 98 - 117 in one of the changes files report/activity_data_inventory.Rmd:

# format data
act=active%>%
  group_by(test_id)%>%
  rename(questionnaire_complete = physical_activity_questionnaire_v3_022118_complete)%>%
  mutate(drop_from_study=if(any(beach_part_drop_out == 0)) 0 else NA)%>%
  mutate(study_visit = factor(study_visit, levels = 
                                c("baseline_arm_1",
                                  "third_trimester_arm_1",
                                  "two_week_arm_1",
                                  "two_month_arm_1",
                                  "six_month_arm_1",
                                  "twelve_month_arm_1")))%>%
  select(-c(redcap_repeat_instrument,
            redcap_event_name,
            redcap_repeat_instance,
            beach_part_drop_out,
            mompa_todays_date)) %>%
  select(test_id,study_visit, everything())%>%
  gather(activity, response, mompa_walk_slow:mompa_dance)%>%
  arrange(test_id, study_visit) %>%
  select(test_id, study_visit, activity, response)

I guess this might because I do not have the authorization to see those entries? Does anyone else can execute this file without reporting an error? @thulium1 @luran1 @TheLunes please review the code during your convenient time, and click merge if you can execute the updated code without reporting an error.

dlemas commented 4 years ago

Please drop the "mompa_todays_date variable" from code and run to check for error.  This is not a variable that needs to be pulled (and ultimately dropped). Dates are marked as PHI in redcap and will be restricted to most users.  @XinsongDu

XinsongDu commented 4 years ago

Done! @dlemas I will create a pull request and merge the updated code.