Returning multiple objects in an R function - JanBask Training
In R programming, functions do not return multiple values, however, you can create a list that contains multiple objects that you want a function to return. For R to return multiple values, use the below code: For example: x <- c (3,4,7,9,34,24,5,7,8) fun = function (x) { mn = mean (x) lt = list (f1=table (x),std=sd (x)) newlist <- list (lt,mn)