write_adat {SomaDataIO}R Documentation

Write an ADAT to File

Description

One can write an existing modified internal ADAT (soma_adat R object) to an external file. However the ADAT object itself must have intact attributes, see is_intact_attr().

Usage

write_adat(x, file)

Arguments

x

A soma_adat object (with intact attributes), typically created using read_adat().

file

Character. File path where the object should be written. For example, extensions should be ⁠*.adat⁠.

Details

The ADAT specification no longer requires Windows end of line (EOL) characters (⁠"\r\n"⁠). The current EOL spec is ⁠"\n"⁠ which is commonly used in POSIX systems, like MacOS and Linux. Since the EOL affects the resulting checksum, ADATs written on other systems generate slightly differing files. Standardizing to ⁠"\n"⁠ attempts to solve this issue. For reference, see the EOL encoding for operating systems below:

Symbol Platform Character
LF Linux ⁠"\n"⁠
CR MacOS ⁠"\r"⁠
CRLF DOS/Windows ⁠"\r\n"⁠

Value

Invisibly returns the input x.

Author(s)

Stu Field

See Also

read_adat(), is_intact_attr()

Other IO: loadAdatsAsList(), parseHeader(), read_adat(), soma_adat

Examples

# trim to 1 sample for speed
adat_out <- head(example_data, 1L)

# attributes must(!) be intact to write
is_intact_attr(adat_out)

write_adat(adat_out, file = tempfile(fileext = ".adat"))

[Package SomaDataIO version 6.1.0 Index]