Learn R Programming

kvh (version 1.4.2)

kvh_get_matrix: 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

Value

matrix read from kvh

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.

Examples

Run this code
# NOT RUN {
# 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")

# }

Run the code above in your browser using DataLab