I want to add a column to a dataframe containing its own name as a string. (This is for inclusion in a function that will bind several of them together...)
Based on this old SO post and my understanding of magrittr pipes I thought this would work:
data(iris)
iris %>%
mutate(df = deparse(substitute(.))
But that just adds a column called "df" populated with full stops! The desired output is the string "iris" in every row of that df column. Can anyone set me right?