First, is this dataset in a tidy form for a t-test?
https://i.stack.imgur.com/tMK6R.png
Second, I'm trying to do a two sample t-test to compare the means at time 3 of treatment a and b for 'outcome 1'. How would I go about doing this?
Sample data:
df <- structure(list(code = c(100, 100, 100, 101, 101, 101, 102, 102,
102, 103, 103, 103), treatment = c("a", "a", "a", "b", "b", "b",
"a", "a", "a", "b", "b", "b"), sex = c("f", "f", "f", "m", "m",
"m", "f", "f", "f", "f", "f", "f"), time = c(1, 2, 3, 1, 2, 3,
1, 2, 3, 1, 2, 3), `outcome 1` = c(21, 23, 33, 44, 45, 47, 22,
34, 22, 55, 45, 56), `outcome 2` = c(21, 32, 33, 33, 44, 45,
22, 57, 98, 65, 42, 42), `outcome 3` = c(62, 84, 63, 51, 45,
74, 85, 34, 96, 86, 45, 47)), .Names = c("code", "treatment",
"sex", "time", "outcome 1", "outcome 2", "outcome 3"),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, -12L))