df_table_3_qol <-dget("pings_2_data_ready") %>%#labelled::look_for("health")filter(eventname %in%c("Baseline", "Month12")) %>%mutate(mobility =case_when(str_detect( p_mobility , "I have no problems in walking about") ~"1",str_detect( p_mobility , "I have some problems in walking about") ~"2",str_detect( p_mobility , "I am confined to bed") ~"3")%>%as.numeric(),selfcare =case_when(str_detect( p_selfcare , "I have no problems with self-care") ~"1",str_detect( p_selfcare , "I have some problems with washing or") ~"2",str_detect( p_selfcare , "I am unable to wash or dress myself") ~"3")%>%as.numeric(),usual_act =case_when(str_detect( p_usual_act , "I have no problems with performing my") ~"1",str_detect( p_usual_act , "I have some problems with performing") ~"2",str_detect( p_usual_act , "I am unable to perform my usual activitie") ~"3")%>%as.numeric(),pain_disc =case_when(str_detect(p_pain_disc , "I have no pain or discomfort") ~"1",str_detect( p_pain_disc , "I have moderate pain or discomfort") ~"2",str_detect( p_pain_disc , "I have extreme pain or discomfort") ~"3") %>%as.numeric(),anxiety =case_when(str_detect(p_anxiety, "I am not anxious or depressed") ~"1",str_detect( p_anxiety, "I am moderately anxious or depressed") ~"2",str_detect( p_anxiety, "I am extremely anxious or depressed") ~"3")%>%as.numeric(),eq_5d = mobility + selfcare + usual_act + pain_disc + anxiety) %>%select(pid, eq_5d, arm, eventname) %>%pivot_wider(id_cols = pid, names_from = eventname, values_from = eq_5d) %>%full_join(df_temp)
# A tibble: 500 × 3
Baseline Month12 arm
<dbl> <dbl> <fct>
1 4 2 Arm 2- Routine Care
2 4 3 Arm 1- Intervention Arm
3 2 0 Arm 1- Intervention Arm
4 2 1 Arm 1- Intervention Arm
5 4 3 Arm 2- Routine Care
6 2 1 Arm 2- Routine Care
7 1 0 Arm 2- Routine Care
8 1 2 Arm 1- Intervention Arm
9 2 1 Arm 2- Routine Care
10 4 2 Arm 1- Intervention Arm
# ℹ 490 more rows