Convert a design list to JSON notation for archiving (e.g. in scienceverse)

json_design(design, filename = NULL, digits = 8, pretty = FALSE, ...)

Arguments

design

a design list including within, between, n, mu, sd, r, dv, id

filename

option name of file to save the json to

digits

number of digits to save

pretty

whether to print condensed or readable

...

other options to send to jsonlite::toJSON

Value

a JSON string

Examples

des <- check_design(2,2)

json_design(des)
#> {"within":{"W1":{"W1a":"W1a","W1b":"W1b"}},"between":{"B1":{"B1a":"B1a","B1b":"B1b"}},"dv":{"y":"value"},"id":{"id":"id"},"vardesc":{"W1":"W1","B1":"B1"},"n":{"B1a":100,"B1b":100},"mu":{"B1a":{"W1a":0,"W1b":0},"B1b":{"W1a":0,"W1b":0}},"sd":{"B1a":{"W1a":1,"W1b":1},"B1b":{"W1a":1,"W1b":1}},"r":{"B1a":[[1,0],[0,1]],"B1b":[[1,0],[0,1]]},"sep":"_"} 
json_design(des, pretty = TRUE)
#> {
#>   "within": {
#>     "W1": {
#>       "W1a": "W1a",
#>       "W1b": "W1b"
#>     }
#>   },
#>   "between": {
#>     "B1": {
#>       "B1a": "B1a",
#>       "B1b": "B1b"
#>     }
#>   },
#>   "dv": {
#>     "y": "value"
#>   },
#>   "id": {
#>     "id": "id"
#>   },
#>   "vardesc": {
#>     "W1": "W1",
#>     "B1": "B1"
#>   },
#>   "n": {
#>     "B1a": 100,
#>     "B1b": 100
#>   },
#>   "mu": {
#>     "B1a": {
#>       "W1a": 0,
#>       "W1b": 0
#>     },
#>     "B1b": {
#>       "W1a": 0,
#>       "W1b": 0
#>     }
#>   },
#>   "sd": {
#>     "B1a": {
#>       "W1a": 1,
#>       "W1b": 1
#>     },
#>     "B1b": {
#>       "W1a": 1,
#>       "W1b": 1
#>     }
#>   },
#>   "r": {
#>     "B1a": [
#>       [1, 0],
#>       [0, 1]
#>     ],
#>     "B1b": [
#>       [1, 0],
#>       [0, 1]
#>     ]
#>   },
#>   "sep": "_"
#> }