qattributes {qs} | R Documentation |
qattributes
Description
Reads the attributes of an object serialized to disk.
Usage
qattributes(file, use_alt_rep=FALSE, strict=FALSE, nthreads=1)
Arguments
file |
The file name/path. |
use_alt_rep |
Use ALTREP when reading in string data (default |
strict |
Whether to throw an error or just report a warning (default: |
nthreads |
Number of threads to use. Default |
Details
Equivalent to:
attributes(qread(file))
But more efficient. Attributes are stored towards the end of the file. This function will read through the contents of the file (without de-serializing the object itself), and then de-serializes the attributes only.
Because it is necessary to read through the file, pulling out attributes could take a long time if the file is large. However, it should be much faster than de-serializing the entire object first.
Value
the attributes fo the serialized object.
Examples
file <- tempfile()
qsave(mtcars, file)
attr1 <- qattributes(file)
attr2 <- attributes(qread(file))
print(attr1)
# $names
# [1] "IAU Name" "Designation" "Const." ...
# $row.names
# [1] 1 2 3 4 5
# $class
# [1] "data.frame"
identical(attr1, attr2) # TRUE