--- title: "paarid1" output: html_document --- ```{r} library(tidyverse) start_k=tibble(e1=c(1, 2, 3), p1=c(2, 3, 5), e2=c(1, 2, 3), p2=c(3, 1, 2)) ``` ```{r} tabel<- sapply(1:2, function(nr){ enimi <- paste("e", nr, sep="") pnimi <- paste("p", nr, sep="") tt <- t.test(as.numeric(start_k[[enimi]]), as.numeric(start_k[[pnimi]]), paired = TRUE, alternative = "two.sided") c(nr, tt$p.value, tt$conf.int[1], tt$conf.int[2]) }) tabel %>% t() %>% as_tibble() %>% rename(jnr=V1, p=V2, alates=V3, kuni=V4) ``` ```{r} ```