Hello all,
Please review the following simple code:
# make a factor:
x <- factor(c("one", "two"))
# what should be the output to the following expression?
c(x, "3") # <=== ????
# I expected it to be as the output of:
c(as.character(x), "3")
# But in fact, the output is what would happen if we had ran the
next line:
c(as.character(as.numeric(x)), "3")
# p.s: c(x, 3) would of course behave differently...
I imagine the above behavior is a "feature" (not a bug), but I am curious
as to what is the rational behind it. Is it because of computational
efficiency, or something that fixes some case study?
Thanks,
Tal
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.