As the doctor gone rogue

May 20, 2012

Obtaining R Object name

Filed under: Uncategorized — Tags: , — hypotheses @ 9:07 am

While programming in R, occasionally I wish I can just get the name of an object that I am working with and print out the name, or use the name as a name for the current plot that I am creating.

This is more convenient when creating a function that your user might not have an idea yet what the title should be. By default, the title name in most plot functions in R is created using “deparse(substitute(x))” function

mydata <- cbind(c(1:10),c(1:10))

Name the plot after the name of the data frame used to create this plot.


Create a free website or blog at