How to assign from a function which returns more than one value?
问题 Still trying to get into the R logic... what is the "best" way to unpack (on LHS) the results from a function returning multiple values? I can't do this apparently: R> functionReturningTwoValues <- function() { return(c(1, 2)) } R> functionReturningTwoValues() [1] 1 2 R> a, b <- functionReturningTwoValues() Error: unexpected ',' in "a," R> c(a, b) <- functionReturningTwoValues() Error in c(a, b) <- functionReturningTwoValues() : object 'a' not found must I really do the following? R> r <-