[Rd] Keep class attribute when applying c() to hexmodes
Schuhmacher, Dominic
dom|n|c@@chuhm@cher @end|ng |rom m@them@t|k@un|-goett|ngen@de
Mon May 27 17:49:06 CEST 2024
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
More information about the R-devel
mailing list