A convenient way to build a data.frame in legible transposed form. Position of first "|" (or other infix operator) determines number of columns (all other infix operators are aliases for ","). Names are de-referenced.
build_frame(..., cf_eval_environment = parent.frame())
cell names, first infix operator denotes end of header row of column names.
environment to evaluate names in.
character data.frame
tc_name <- "training"
x <- build_frame(
"measure", tc_name, "validation" |
"minus binary cross entropy", 5, -7 |
"accuracy", 0.8, 0.6 )
print(x)
#> measure training validation
#> 1 minus binary cross entropy 5.0 -7.0
#> 2 accuracy 0.8 0.6
str(x)
#> 'data.frame': 2 obs. of 3 variables:
#> $ measure : chr "minus binary cross entropy" "accuracy"
#> $ training : num 5 0.8
#> $ validation: num -7 0.6
cat(draw_frame(x))
#> x <- wrapr::build_frame(
#> "measure" , "training", "validation" |
#> "minus binary cross entropy", 5 , -7 |
#> "accuracy" , 0.8 , 0.6 )
build_frame(
"x" |
-1 |
2 )
#> x
#> 1 -1
#> 2 2