Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Latest commit

 

History

History
63 lines (45 loc) · 1.83 KB

README-not.md

File metadata and controls

63 lines (45 loc) · 1.83 KB

Project Status: Active – The project has reached a stable, usable state and is being actively developed. R-check

staypuft is a port of Python's marshmallow for converting objects to and from R data structures

Main Schema methods:

  • load: 'deserialize', or validate and deserialize an input R data structure (e.g., list) to an object
  • dump: 'serialize', or convert any input (e.g., R6 class) to R data structures (e.g., list)
  • load_json: same as load, but accepts JSON
  • dump_json: same as dump, but returns JSON

Installation

remotes::install_github("ropensci/staypuft")
library("staypuft")

example

z <- Schema$new("MySchema",
  name = fields$character(),
  title = fields$character(),
  num = fields$integer()
)
z
#> <schema: MySchema>
#> fields: name, title, num
x <- list(name = "Jane Doe", title = "Howdy doody", num = 5.5)
z$load(data = x)
#> $name
#> [1] "Jane Doe"
#> 
#> $title
#> [1] "Howdy doody"
#> 
#> $num
#> [1] 5.5

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for staypuft in R doing citation(package = 'staypuft')
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

rofooter