Read/Write Files in Key-Value-Hierarchy Format

The format KVH is a lightweight format that can be read/written both by humans and machines. It can be useful in situations where XML or alike formats seem to be an overkill. We provide an ability to parse KVH files in R pretty fast due to 'Rcpp' use.


This package can read/write KVH files in R. The format KVH is a lightweight format that can be read/written both by humans and machines. It can be useful in situations where XML or alike formats seem to be an overkill. We provide an ability to parse KVH files in R pretty fast due to 'Rcpp' use. Key/Values that are returned by kvh_read() are always character strings. User has to convert them furthermore to somewhat usefull for him.

Example:

     # prepare object to write to kvh file
     obj=list(x=structure(1:3, names=letters[1:3]), R=R.version)
     # write it
     obj2kvh(obj, "test", "test.kvh") # will create test.kvh file
     # read it back
     l=kvh_read("test.kvh")
     # check a field
     l$test$x # NB. it has a character values put in a list not a numeric vector as it was in obj.
     attr(l$test$x, "ln") # line number where the entry test/x started in test.kvh

News

Version 1.4.1

  • 2019-04-28
  • fixed usage of errno and std::strerror()

Version 1.4

  • 2019-04-23
  • fixed usage of relative paths when follow_url is true

Version 1.3

  • 2018-06-14
  • added optional parameters split_str and follow_url to read_kvh()

Version 1.2

  • 2018-05-14
  • added optional parameters comment_str, strip_white and skip_blank to read_kvh()

Version 1.1

  • 2017-12-06
  • added integer attribute 'ln' (line number) to values returned by kvh_read()
  • added new function obj_by_keys()
  • added BugReports to DESCRIPTION
  • added README.md for github
  • added export of esc_kvh_k() and esc_kvh_v() functions
  • parameter 'objname' may be set to NULL (default) and ignored

Version 1.0.1

  • 2017-10-02
  • initial commit to CRAN

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("kvh")

1.4.1 by Serguei Sokol, 2 months ago


http://serguei.sokol.free.fr/kvh-format/


Report a bug at https://github.com/sgsokol/kvh/issues


Browse source code at https://github.com/cran/kvh


Authors: Serguei Sokol


Documentation:   PDF Manual  


GPL (>= 2) license


Imports Rcpp

Suggests testthat

Linking to Rcpp


See at CRAN