[R] Make sure a data frame has been "fun through" a function

Bert Gunter bgunter.4567 at gmail.com
Tue Feb 21 00:53:24 CET 2017


Yes.

To elaborate a bit on Ista's reply:

A)   The only way I can imagine hiding info from a user would be to encrypt
it. This could be done programmatically I think, but I would have to
research it to figure out how.

B) If all you want to do is prevent the info from being printed, just
create e.g  an S3 class of type "foo" that inherits from "data.frame" with
your info as an attribute and provide a print.foo method that just prints
the data frame without the attribute. Your function can access and use the
attribute any way it likes.

Cheers,
Bert


Bert

On Feb 20, 2017 1:27 PM, "Ista Zahn" <istazahn at gmail.com> wrote:

It depends on what you mean by 1). If you mean "won't annoy the user" then
yes, e.g., add something to the class attribute. If 1) means "can't be
discovered by the user" then no (at least not easily). Anything you can see
they can see.

Best,
Ista


On Feb 20, 2017 4:21 PM, "stephen sefick" <ssefick at gmail.com> wrote:

Hello,

I would like to add something to a data frame that is 1) invisible to the
user, 2) has no side effects, and 3) I can test for in a following
function. Is this possible? I am exploring classes and attributes and I
have thought about using a list (but 1 and 2 not satisfied). Any help would
be greatly appreciated.

I did not provide a reproducible example because I see this as more of a R
language question, but I will be happy to make a toy example if that would
help.

I appreciate all of the help.

kindest regards,

--
Let's not spend our time and resources thinking about things that are so
little or so large that all they really do for us is puff us up and make us
feel like gods.  We are mammals, and have not exhausted the annoying little
problems of being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal
science."

                              -Robert Gentleman

        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list