There’s more…

An output data type could be one of the many available data types in R, and you could organize the output into a different data structure. For example, the output of this function can be returned as a list of two named elements by creating the function as follows:

    meanSe <- function(numVec){
if(is.numeric(numVec) & is.vector(numVec)){
avg <- mean(numVec)
std <- sd(numVec)
se <- std/sqrt(length(numVec))
out <- list(mean = avg, standardError = se)
return(out)
}
}
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset