kvh_get_matrix {kvh}R Documentation

Get matrix from kvh file

Description

Given a read connection to kvh file and a vector of keys pointing to a matrix, return this matrix

Usage

kvh_get_matrix(f, v)

Arguments

f

connection from which kvh file can be read

v

character vector of key-subkeys pointing to a matrix

Details

It is expected that matrix in the kvh file has its upper-leftmost item called "row_col" and it has rownames in the first column and colnames in the first row.

Value

matrix read from kvh

Examples

# write a test matrix
obj2kvh(list(comment="this is a test matrix",  m=diag(2)), "li", "test.kvh")
# read it back
mr=kvh_get_matrix(file("test.kvh"), c("li", "m"))
# clean
unlink("test.kvh")


[Package kvh version 1.4.2 Index]