From the following vector:
Lagos <- c(41,72,8,93,4,37,73,190,45,22,19)
I want to create a function that shows in the console the mean and standard deviation of that vector and that optionally can change the mean by the median
I have done the following:
Lakers <- function(x){
r <- mean(x)
s <- sd(x)
t <- median(x)
print(r)
print(s)
print(t)
}
The function responds correctly but the big problem is that I do not know how to indicate to that function that OPTIONALLY change the average by the median
If you could help me improve it please, I would appreciate it.