Generation

generate functionFri, 28 Apr 2023

summary(s_complete$num_SNB) aggregate(num_SNB ~ Condition_SNB, data = s_complete, FUN = summary) sd(s_complete$num_SNB) count <- table(s_complete$num_SNB) please combine these computations in one code.

# define a function myfun <- function(x){ a <- mean(x) b <- sd(x) c <- table(x) return(c(a, b, c)) } # use apply over the dataframe apply(s_complete[c("num_SNB", "Condition_SNB")], 2, myfun)

Questions about programming?Chat with your personal AI assistant