View source: R/zz_help_files.R
qattributes | R Documentation |
Reads the attributes of an object serialized to disk.
qattributes(file, use_alt_rep=FALSE, strict=FALSE, nthreads=1)
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 |
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.
the attributes fo the serialized object.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.