[R] Outputting variable names and their value bindings

Simon Ellis @e|||@ @end|ng |rom v@@@@r@edu
Mon Jun 25 02:59:54 CEST 2018


Hullo Jim,

That's wonderful: thank you so much! That makes things even easier. There
are also no problems regarding getting rid of the function as each set of
computations occurs in a new Rstudio process: it's not optimal, but given
the problem it was the best solution. My code will just stick this print
function at the very top of each R script, and then I can get my
collaborator to call it where there are variables to be read out.

This is great. Thank you again! :-)

On 24 June 2018 at 20:37, Jim Lemon <drjimlemon using gmail.com> wrote:

> Hi Simon,
> Easy to do if you call "print" directly:
>
> print<-function(x) cat(deparse(substitute(x)),"=\n",x,"\n")
> y<-3
> print(y)
> y =
>  3
>
> Obviously you will want to get rid of your print function when it is
> not being used with "rm" or by starting a new session. Getting it to
> bypass the default print method is more difficult and I don't have the
> time to untangle that one at the moment.
>
> Jim
>



-- 
Visiting Assistant Professor,
Department of Computer Science,
Vassar College,
Poughkeepsie, NY 12604

“The whole modern world has divided itself into Conservatives and
Progressives. The business of Progressives is to go on making mistakes. The
business of Conservatives is to prevent mistakes from being corrected.” *--
G. K. Chesterton*

	[[alternative HTML version deleted]]




More information about the R-help mailing list