Hi, I would like to add column to an existing data frame that contains the name of that data frame. The value in the new column would be dynamic, i.e. would depend on the name of the data frame.
For example, say I create the following data frame called "my_df":
my_df <- data.frame(letters = c("a","b","c"), numbers = c(1,2,3))
Then I would like to add a column called "dataframe_name" containing the value "my_df". I could do it manually as follows:
my_df <- my_df %>% mutate(dataframe_name = "my_df")
But is there a way to do this "dynamically" so that the name in the new column will be whatever the name of the data frame is?
Thank you for your time.