Dear list,

I am puzzled by this,

substitute(expression(x), list(x = factor(letters[1:2])))
# expression(1:2)

Why do I get back the factor levels inside the expression and not the
labels? The following work as I expected,

substitute(expression(x), list(x = letters[1:2]))
# expression(c("a", "b"))

substitute(x, list(x = factor(letters[1:2])))
# [1] a b
# Levels: a b

 bquote(.(factor(letters[1:2])))
# [1] a b
# Levels: a b


All the best,

baptiste

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to