Converts a list to a data.frame based on given parameter set.

List elements must have the correct type with respect to parameter set. Exceptions are discrete parameters, whose values should be factors, only characters are accepted and factors are returned.

Returned data.frame has column names equal to parameter ids. In case of vector parameters column names will be numbered.

listToDf(list.object, par.set)

Arguments

list.object

[list] list of individuals, each with elements named by parameter ids.

par.set

[ParamSet] parameter set.

Value

[data.frame]

Examples

library(mlrCPO) # Create parameter set temp <- c("a", "b", "c") ps.simple <- pSS( num: numeric [0, 10], int: integer[0, 10] [[trafo = function(x) x / 10]], char: discrete [temp], selector.selection: logical^10) # Sample values as list and convert list to data frame init.list <- sampleValues(ps.simple, 5, discrete.names = TRUE) result <- listToDf(init.list, ps.simple) result
#> num int char selector.selection1 selector.selection2 #> 1 3.9121765 7 c TRUE TRUE #> 2 9.4736835 5 b TRUE FALSE #> 3 5.6178796 6 a FALSE TRUE #> 4 3.1302513 1 a TRUE FALSE #> 5 0.2720537 2 b TRUE FALSE #> selector.selection3 selector.selection4 selector.selection5 #> 1 TRUE TRUE TRUE #> 2 TRUE FALSE FALSE #> 3 FALSE FALSE TRUE #> 4 FALSE FALSE TRUE #> 5 FALSE FALSE TRUE #> selector.selection6 selector.selection7 selector.selection8 #> 1 FALSE FALSE FALSE #> 2 FALSE FALSE FALSE #> 3 FALSE TRUE FALSE #> 4 TRUE FALSE TRUE #> 5 TRUE TRUE TRUE #> selector.selection9 selector.selection10 #> 1 FALSE TRUE #> 2 TRUE TRUE #> 3 TRUE TRUE #> 4 TRUE TRUE #> 5 TRUE TRUE