Suppose I have the following function:
print_argument <- function(vector) {
message(substitute(vector))
}
This function does what I want for the most part, e.g.,
abc <- 1:3
print_argument(abc)
# output:
# abc
But it doesn't work for the following argument:
df <- data.frame(a = 1:3)
col_name <- "a"
print_argument(df[[col_name]])
# output:
# [[dfcol_name
How would you update the function so that it also prints (using the message function) arguments like df[[col_name]] verbatim?
That is, how would you make it print (using the message function) the following: df[[col_name]]