--- 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 <- cor.test(as.numeric(start_k[[enimi]]), as.numeric(start_k[[pnimi]])) c(nr, tt$estimate %>% unname(), tt$p.value) }) tabel %>% t() %>% as_tibble() %>% rename(jnr=V1, cor=V2, p=V3) ``` ```{r} ```