Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract name of data.frame in R as character

Tags:

dataframe

r

How can I extract the name of a data.frame in R as a character?

For example, if I have data.frame named df, I want to get "df" as a character object.

like image 279
Gaurav Bansal Avatar asked Jul 18 '17 20:07

Gaurav Bansal


1 Answers

a <- data.frame()
deparse(substitute(a))
[1] "a"

This is also how plot knows what to put on the axes

like image 168
Vandenman Avatar answered Oct 13 '22 08:10

Vandenman