How about this? Makes use of the map functions...for a good overview see chapter 21.5 of the 'R for Data Science' book (http://r4ds.had.co.nz/). They are very similar to apply/sapply/lapply family of functions if you are familar with those - essential they iteratively apply functions to the elements of a list.
suppressPackageStartupMessages(library(tidyverse))
# All correlations by for each cycle level
all <- mtcars %>%
split(.$cyl) %>%
map(cor)
#> Warning in .f(.x[[i]], ...): the standard deviation is zero
#> Warning in .f(.x[[i]], ...): the standard deviation is zero
#> Warning in .f(.x[[i]], ...): the standard deviation is zero
all[[1]][1:3, 1:3]
#> mpg cyl disp
#> mpg 1.0000000 NA -0.8052361
#> cyl NA 1 NA
#> disp -0.8052361 NA 1.0000000
# dropping cyl to avoid cor(cyl, other_variable) within each split
all_2 <- mtcars %>%
split(.$cyl) %>%
map(select, -c(cyl)) %>%
map(cor)
#> Warning in .f(.x[[i]], ...): the standard deviation is zero
all_2[[1]][1:3, 1:3]
#> mpg disp hp
#> mpg 1.0000000 -0.8052361 -0.5235034
#> disp -0.8052361 1.0000000 0.4346051
#> hp -0.5235034 0.4346051 1.0000000
# similarly for just vars you care about calculating the correlation for ---
vars_keep <- names(mtcars)[c(1, 3, 4)]
some <- mtcars %>%
split(.$cyl) %>%
map(select, vars_keep) %>%
map(cor)
some[[1]]
#> mpg disp hp
#> mpg 1.0000000 -0.8052361 -0.5235034
#> disp -0.8052361 1.0000000 0.4346051
#> hp -0.5235034 0.4346051 1.0000000