[R] Text dependent on a variable in a R function

Jim Lemon jim at bitwrit.com.au
Sun May 2 10:07:12 CEST 2010


On 05/02/2010 11:56 AM, R K wrote:
>
> Hello,
>
> I was wondering if someone could tell me how I can make text dependent on a variable in a R function I have created.
>
> The function will create plots, thus I would like each plot to have a unique title based on the inputted variable as well as a unique file name when saved using the savePlot function.
>
Hi Rachel,
I think what you are looking for is the somewhat obscure:

deparse(substitute(x))

that returns the name of a variable as a character string.

Jim



More information about the R-help mailing list