kvh_get_matrix: Get matrix from kvh file

Description Usage Arguments Details Value Examples

View source: R/kvh.R

Description

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

Usage

1

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

1
2
3
4
5
6
# 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")

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