abc = data.frame(a = 1, b = 2)
double_check = function(x) {
if (!missing(x)) {
if (!exists(x)) {
print('yay')
}
}
}
double_check(abc) # I need this to work
double_check(1)
double_check('abc') # Not this
I tried exists(as_string(x)), exists(as.name(x)) and other variants, but no luck.
Are you wanting a function that tests it has been given a data.frame ?
if so.
abc = data.frame(a = 1, b = 2)
double_check = function(x) {
if (!missing(x)) {
if (is.data.frame(x))
print('yay')
}
}
double_check(abc) # I need this to work
double_check(1)
double_check('abc')