This function gives you a mean with 95 percent CIs

corr(df, var1, var2)

Arguments

df

Name of the Dataset

var1

First variable

var2

Second variable

Examples

x <- c(1, 2, 3, 7, 5, 777, 6, 411, 8) y <- c(11, 23, 1, 4, 6, 22455, 34, 22, 22) z <- c(34, 3, 21, 4555, 75, 2, 3334, 1122, 22312) test <- data.frame(x,y,z) %>% as.tibble()
#> Warning: `as.tibble()` is deprecated, use `as_tibble()` (but mind the new semantics). #> This warning is displayed once per session.
test %>% filter(z > 10) %>% corr(x,y)
#> # A tibble: 1 x 8 #> estimate statistic p.value n conf.low conf.high method alternative #> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <chr> <chr> #> 1 0.288 0.673 0.531 5 -0.594 0.856 Pearson's pro~ two.sided