I want to extract a variable name from a data frame a create a new variable with dplyr::mutate. What do I have to write so that the variable name provided through "md$meta[1]" is accepted? I think this is straight forward but I haven't been able to find the answer on the web. Any help greatly appreciated!
Fake data
iris <- head(iris)
meta <- c("a", "b", "c")
data <- c(1:3)
md <- data.frame(meta, data)
rm(meta, data)
Desired output
iris <- iris %>%
mutate("a" = md$data[1])
Code attempt
iris <- iris %>%
mutate(paste0(md$meta[1]) = md$data[1])