Search code examples
rpki

R raw to Hex conversion


I am trying to take a look at how the rawToHex() function is implemented in PKI package.

I tried this:

> library(PKI)
Loading required package: base64enc
> PKI::rawToHex
Error: 'rawToHex' is not an exported object from 'namespace:PKI'
> PKI:::rawToHex
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
object 'rawToHex' not found

I am basically trying to understand how to convert raw data to Hex representation in R. So I wanted to take a look at this.


Solution

  • That error is clear: that function is not available in that package. The correct spelling is raw2hex

    > PKI::raw2hex
    function (what, sep, upper = FALSE) 
    .Call(PKI_raw2hex, what, if (missing(sep)) NULL else sep, upper)
    <environment: namespace:PKI>
    

    You can't see the source in this way because it is compiled.

    Please read this great answer.

    Besides that, you can download the source code in CRAN.