diagnosis.gds | R Documentation |
Diagnose the GDS file and data information.
diagnosis.gds(gds, log.only=FALSE)
gds |
an object of class |
log.only |
if |
A list with stream and chunk information.
If gds
is a "gds.class"
object (i.e., a GDS file), the
function returns a list with components, like:
stream |
summary of byte stream |
log |
event log records |
If gds
is a "gdsn.class"
object, the function returns a list
with components, like:
head |
total_size, chunk_offset, chunk_size |
data |
total_size, chunk_offset, chunk_size |
... |
Xiuwen Zheng
# cteate a GDS file
f <- createfn.gds("test.gds")
set.seed(1000)
rawval <- as.raw(rep(0:99, 50))
add.gdsn(f, "label", NULL)
add.gdsn(f, "raw", rawval)
closefn.gds(f)
##
f <- openfn.gds("test.gds")
diagnosis.gds(f)
diagnosis.gds(f$root)
diagnosis.gds(index.gdsn(f, "label"))
diagnosis.gds(index.gdsn(f, "raw"))
closefn.gds(f)
## remove fragments
cleanup.gds("test.gds")
##
f <- openfn.gds("test.gds")
diagnosis.gds(f$root)
diagnosis.gds(index.gdsn(f, "label"))
(adr <- diagnosis.gds(index.gdsn(f, "raw")))
closefn.gds(f)
## read binary data directly
f <- file("test.gds", "rb")
dat <- NULL
for (i in seq_len(length(adr$data$chunk_offset)))
{
seek(f, adr$data$chunk_offset[i])
dat <- c(dat, readBin(f, "raw", adr$data$chunk_size[i]))
}
identical(dat, rawval) # should be TRUE
close(f)
# delete the temporary file
unlink("test.gds", force=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.