Getting the name of a data frame

后端 未结 1 1640
感情败类
感情败类 2021-01-12 18:24

I am writing a wrapper function for plotting several data frames:

gf <- function(dataframe){
  ggplot(dataframe, aes(x=Date, y=Close)) + 
  geom_point() +         


        
1条回答
  •  借酒劲吻你
    2021-01-12 18:50

    This will do it:

    ggtitle(deparse(substitute(dataframe)))
    

    deparse() converts the variable name to a character string, substitute() lets you use it in the plot.

    0 讨论(0)
提交回复
热议问题