How do i compute compute the ttest for the pre and post variables across the two groups(x and y)?

Group Pre post
x 5 6
x 7 7
x 4 5
x 4 7
y 2 4
y 5 5
y 6 7
y 3 6
. .
.
.
.
.
.
.

library(tidyverse)
Group <- c(1,1,1,1,2,2,2,2)
Pre <- c(5,7,4,4,2,5,6,3)
Post <- c(6,7,5,7,4,5,7,6)
dta <- as_tibble(cbind(Group,Pre,Post)) %>% 
  mutate(diff=Pre-Post)

t.test(diff ~ Group, data=dta, paired = TRUE)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.