obj2kvh: Writing/Adding an R Object to KVH File.

Description Usage Arguments Details Value Examples

View source: R/kvh.R

Description

Formats an object before writing it in kvh file.

Usage

1
obj2kvh(obj, objname = NULL, conct = stdout(), indent = 0)

Arguments

obj

an R object

objname

character object name to write in kvh file

conct

connection opened for writing

indent

is tab offset for object name

Details

Scalar, vector, matrix and list are pre-processed. Other objects are written as an output string of toString() function To add a content to existent file use "a" as open mode fcn=file("m.kvh", "a") obj2kvh() can be used along the code advancing in the calculations. Writing in a subfield of an already started key requires use of appropriate indent value. The file is started with indent=0 and every sub-field increments the indent by 1. If objname is NULL and obj is not a scalar value, the content of obj is written in kvh file without additional indent.

Value

None

Examples

1
2
3
4
5
6
m=matrix(1:6,2,3);
fcn=file("m.kvh", "w");
obj2kvh(m, "m", fcn);
close(fcn);
# clean
unlink("m.kvh")

kvh documentation built on Jan. 27, 2022, 1:15 a.m.