# Just testing :)
library(ggplot2)
library(dplyr)
col_means <- function(df) {
numeric <- sapply(df, is.numeric)
numeric_cols <- df[, numeric]
data.frame(lapply(numeric_cols, mean))
}
col_means(mtcars)
col_means(diamonds[,c("cut", "color")])
col_means(mtcars |> rbind(NA))
col_means(as.list(diamonds))
col_means(NA)
col_means(c(14,12,19))
col_means()
col_means(function(x) x^2)
col_means(data.frame())
col_means(diamonds |> dplyr::filter(color=="C"))
col_means(col_means(diamonds))Code for testing
code
Week07