Dear list,

The following behavior in base R is unexpected to me:

a <- as.hexmode("99ac")
b <- as.hexmode("9ce5")
v <- c(a,b)
v
#> [1] 39340 40165
class(v)
#> [1] "integer"

Is there a good reason why v should not be of class "hexmode"?

I can see that this is exactly as documented. The help for `c()` only says that 
the arguments are coerced to a common type (which is integer anyway) and that 
all attributes except names are removed. On the other hand, it says further 
down that "c methods other than the default are not required to remove 
attributes (and they will almost certainly preserve a class attribute)".

So couldn't (or even shouldn't) there be a c.hexmode that keeps the class 
attribute?

Best regards,
Dominic


------------------------------------------
Prof. Dr. Dominic Schuhmacher
Institute for Mathematical Stochastics
University of Göttingen, Germany
https://dschuhm1.pages.gwdg.de




______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to