This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
57 lines (43 loc) · 1.83 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!-- README.md is generated from README.Rmd. Please edit that file and knit -->
```{r echo=FALSE}
knitr::opts_chunk$set(
comment = "#>",
collapse = TRUE,
warning = FALSE,
message = FALSE
)
```
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R-check](https://github.com/ropensci/staypuft/workflows/R-check/badge.svg)](https://github.com/ropensci/staypuft/actions/)
`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
```{r eval=FALSE}
remotes::install_github("ropensci/staypuft")
```
```{r}
library("staypuft")
```
## example
```{r}
z <- Schema$new("MySchema",
name = fields$character(),
title = fields$character(),
num = fields$integer()
)
z
x <- list(name = "Jane Doe", title = "Howdy doody", num = 5.5)
z$load(data = x)
```
## Meta
* Please [report any issues or bugs](https://github.com/ropensci/staypuft/issues).
* 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][coc]. By participating in this project you agree to abide by its terms.
[![rofooter](https://ropensci.org/public_images/github_footer.png)](https://ropensci.org)
[marshmallow]: https://github.com/marshmallow-code/marshmallow/
[coc]: https://github.com/ropensci/staypuft/blob/master/CODE_OF_CONDUCT.md