I’m trying to write a function in R that will return as its output, an one output from a previous function. The previous function returns a list of 3 different things.
So far the only way I’ve worked out how to do this is completely copy and paste the original function, and get it to return only one answer, but surely there is a shorter way in which to do this?
If the original function is named
foo(), as inthen just do
or simply use
foo(something)$tssto directly access thetsscomponent of the return value offoo(). There is really no need to wrap another functionbar()aroundfoo().