I need to find p value for a set of variables in a 2 groups (treatment and control) 2-times scenario (same subjects, pre and post). groups have the same n, with different subjects that have been randomly assigned.
My data looks like this:
> str(t_wide)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame': 32 obs. of 31 variables:
$ Subject : num 1 1 2 2 3 3 4 4 5 5 ...
$ Time : num 0 1 0 1 0 1 0 1 0 1 ...
$ Group : chr "Treat" "Treat" "Treat" "Treat" ...
$ VAR1 : num 7.6 7.7 9.4 9.5 8.3 8.2 7.5 7.6 7.4 7.4 ...
$ VAR2 : num 8400 8350 8200 8220 8300 8400 7200 7380 7200 7250 ...
...
my first try was to get p value like this:
t.test( VAR1 ~ Group, data=t_wide )
but i guess this leave Time variable out of the model (and probably just duplicates the cases in each group). how should i proceed? should i calculate some sort of variance of pre/post for each subject?
many thanks!