Code below.
func <- function(x){ print( paste(substitute(x)) ) } ; func(x[])
If I run func(x), the code print "x" out, but if I run like func(x[]) or func(x$y), it cannot print "x[]" or "x$y" out correctly. How can I get the correct input string? Thank you.
Similar example is like plot() function, when I use plot(x$y), the ylab is "x$y". When I use plot(x[]), the ylab is "x[]". When I use plot(1:20), the ylab is "1:20".