To calculate the column-wise mean of a data frame in R, you can use the colMeans() function. It calculates the mean of each column separately and returns a vector of mean values.
Example code:
# Create a data frame
df <- data.frame(a = c(10, 20, 30), b = c(40, 50, 60), c = c(70, 80, 90))
# Calculate the column-wise mean
column_means <- colMeans(df)
print(column_means)
Output:
a b c
20.0 50.0 80.0