I have a database a little bit tidier than the original thanks to a StackOverflow colleague I'm really grateful
The data frame is composed of a patient ID which has several measurements along time (00 = basal, 66 = 6 months, 01 = 12 months). I know I put the data frame not chronologically ordered
df1<-data.frame(pacient<- c(6430, 6430, 6430, 6494, 6494, 6494, 6165, 6165, 6165),
time<- c(00, 01, 66, 00, 01, 66, 00, 01, 66),
weight <- c(115, 112, 110, 98, 95, 94, 88, 87, 86),
waist <- c(123, NA, 112, 115, 112, 113, 112, 110, NA),
p14_total<- c(7, NA, 4, 12, 5, NA, 15, 12, 13))
- t.test
I am trying to perform comparisons between the measurements between the different time points, NOT paired. For example weight at 00 vs weight at 66 / weight at 00 vs weight at 01 /weight at 66 vs weight at 01 I am looking for a data frame or data.table to export with the statistics (t, pvalue, mean..)
- Create a column with the difference between the different time measurements for each patient. For example: patient ID: 6430 Weight_6months = Weight01 - Weight66 Weight_12months= Weight01 - Weight00
I am really trying to perform this with purrr::map functions but I'm not reaching the objective