read_elements-methods: Read a sequence of elements from an input source

read_elementsR Documentation

Read a sequence of elements from an input source

Description

Read a sequence of elements from an input source

Usage

read_elements(x, num_elements)

Arguments

x

the input channel

num_elements

the number of elements to read

Value

A vector containing the elements read from x.

Examples

# 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)

bbuchsbaum/neuroim2 documentation built on Feb. 26, 2025, 3:49 p.m.