How to use colmeans() function In R Language
The colmean() function call be simply called by passing the parameter as the data frame to get the mean of every column present in the data frame separately in the R language.
Syntax:
colMeans(dataframe)
where dataframe is the input dataframe.
Example:
Under this example, we will be using the colmeans() function with the data frame containing three different columns to get the mean of each column present in the R language.
R
# create dataframe with three columns data= data.frame (col1= c (1,34,56,32,23), col2= c (21,34,56,32,34), col3= c (1:5)) # get mean of all columns print ( colMeans (data)) |
Output:
col1 col2 col3 29.2 35.4 3.0
How to Use ColMeans Function in R?
In this article, we will discuss how to use the ColMeans function in R Programming Language.