Writes a variable descriptor JSON file for input or output variables, based on an input dataframe containing predictor and prediction columns.

write_in_out_json(data, input = TRUE, path = NULL, noFile = FALSE)

Arguments

data

data.frame to map the correct variable types to Json

input

TRUE to write inputVar.json and FALSE to write outputVar.json

path

directory where the JSON file is written; required when noFile = FALSE

noFile

if you don't want to write to a file, only the output

Value

  • list of the mapped types and sizes.

  • 'inputVar.json' or 'outputVar.json' file written to path

Examples


write_in_out_json(iris[,5, drop = FALSE], input = FALSE, noFile = TRUE)
#>      name length   type   level   role
#> 1 Species     10 string nominal output
write_in_out_json(iris[,1:4], input = TRUE, noFile = TRUE)
#>           name length    type    level  role
#> 1 Sepal.Length      8 decimal interval input
#> 2  Sepal.Width      8 decimal interval input
#> 3 Petal.Length      8 decimal interval input
#> 4  Petal.Width      8 decimal interval input