这一章我感觉整体比较难
课后练习有两题不会
medAndmea <- function(x,funs){
if(length(x) == 0) {stop("There is a missing")
}else{
funs <- match.arg(funs,choices = c("mea","med"))
switch (funs,
"mea" = mean(x),
"med" = median(x))
}
}
x <- c(1,4,3)
medAndmea(x,"mea")