This is a job for purrr::map_if().
library(purrr)
mixed_list <- list(mtcars, mtcars, letters)
map(mixed_list, class)
#> [[1]]
#> [1] "data.frame"
#>
#> [[2]]
#> [1] "data.frame"
#>
#> [[3]]
#> [1] "character"
output <- map_if(mixed_list, is.data.frame, as.matrix)
map(output, class)
#> [[1]]
#> [1] "matrix" "array"
#>
#> [[2]]
#> [1] "matrix" "array"
#>
#> [[3]]
#> [1] "character"
Created on 2020-08-10 by the reprex package (v0.3.0)