I want to make a function that takes one variable and returns multiple outputs, so that I can use the latter for other purposes beyond the function. Take the simplified version below for example:
user <- function(x){a <- x+1; a <- a+0.1; b <- a*-1}
sum(a,b)
So if I input user(10)
, a
would be 11.1, b
would be -11.1, and sum(a,b)
would return 0. But currently R is telling me neither object 'a' or object 'b' is found. How can I fix this?