Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201943

How can I create an object that stores data.frames, and allows one to retrieve them with '.'?

$
0
0

Often times, when I'm using different 3rd party functions, said functions will return some useful data structure that stores a lot of data that I can retrieve with .. Let's say, for example, I'd like to return two data frames, Red and Blue.

I'd like for the user to be able to do something like:

stuff <- this_nice_function()
stuff.Red$column_name
stuff.Blue$column_name

As a bonus, if said user were to just write stuff into the console, I'd like an output like...

This contains two data.frames, Red and Blue. 
Red is size [x]. Blue is size [y]
Available fields: Red, Blue

(Or something like this, similar to the output of dbscan)

I've looked around quite a bit, but the . related threads are focused on the usage of . in a function argument.


Viewing all articles
Browse latest Browse all 201943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>