# Open a connection and configure it so all 'uint32' values are
# read as floating point and all all 'uint64' values are read as hexadecimal strings
con <- rawConnection(as.raw(c(1:7, 0, 1:7, 0, 1:7, 0, 1:7, 0)), "rb")
con <- set_integer_promotion(con, uint32 = "dbl", uint64 = "hex")
# Future reads of uint64 will return hex strings
read_uint64(con, n = 2)
# Unless over-ridden during the read
read_uint64(con, n = 1, promote = "dbl")
close(con)
Run the code above in your browser using DataLab