I want to save the argument of a function as a variable in r. I've tried deparse, but on a dataframe it returns the wrong thing. Below is what I want.
dataframe <- data.frame(a=c(1, 2, 3), b=c(3, 6, 8))
afunction <- function(arg1, arg2) {
arg1_character <- deparse(arg1)
arg2_character <- deparse(arg2)
}
afunction(a ~ b, dataframe)
Based on this simple example I'd want the following output:
arg1_character <- "a~b"
arg2_character <- "dataframe"