Correct option is A
In R, the mean() function is used to calculate the arithmetic mean of a numeric vector. It takes a numeric vector as input and returns the mean value, which is the sum of the elements divided by the total number of elements.
Example:
Important Key Points:
1. The mean() function is an inbuilt function in R used to calculate the
average value of a vector.
2. It handles
NA values by using the argument na.rm = TRUE. Example:
3. It is a part of R’s
core statistical functions and does not require additional libraries.
Knowledge Booster:
·
avg(): This is not a valid function in R for calculating the mean.
·
median(): This calculates the
median (middle value) of a vector, not the mean. Example: median(c(10, 20, 30)) gives 20.
·
summarize(): This is used in the dplyr package for creating summaries of data, but not specifically for calculating the mean.
·
aggregate(): Used for summarizing data by groups, typically in data frames or lists, but requires explicit specification of operations like mean.