2015-03-18 101 views
1

我想将大数字转换为R中的十六进制表示,但它失败了,因为它无法放入32位整数。有什么办法克服这个限制吗?以十六进制打印大数字

> print(0xffffffff+0x10000000) 
[1] 4563402751 
> as.hexmode(0xffffffff+0x10000000) 
Error in if (is.double(x) && (x == as.integer(x))) x <- as.integer(x) : 
    missing value where TRUE/FALSE needed 
In addition: Warning message: 
In as.hexmode(4294967295 + 268435456) : NAs introduced by coercion 

回答

2

幸运的是我找到了解决办法,但需要图书馆GMP

library(gmp) 
> as.character(as.bigz(0xffffffff+0x10000000),b=16) 
[1] "10fffffff"