read_elements | R Documentation |
Read a sequence of elements from an input source
read_elements(x, num_elements)
x |
the input channel |
num_elements |
the number of elements to read |
A vector
containing the elements read from x
.
# Create a temporary binary file with test data
tmp <- tempfile()
con <- file(tmp, "wb")
test_data <- rnorm(100)
writeBin(test_data, con, size = 8)
close(con)
# Create a BinaryReader and read the data
reader <- BinaryReader(tmp, byte_offset = 0L,
data_type = "double", bytes_per_element = 8L)
data <- read_elements(reader, 100)
close(reader)
# Clean up
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.