dfRowsToList: Convert a data.frame row to list of parameter-value-lists.

View source: R/dfRowsToList.R

dfRowsToListR Documentation

Convert a data.frame row to list of parameter-value-lists.

Description

Please note that (naturally) the columns of df have to be of the correct type w.r.t. the corresponding parameter. The only exception are integer parameters where the corresponding columns in df are allowed to be numerics. And also see the argument enforce.col.types as a way around this restriction.

numeric(vector) numeric
integer(vector) integer
discrete(vector) factor (names of values = levels)
logical(vector) logical

Dependent parameters whose requirements are not satisfied are represented by a scalar NA in the output.

Usage

dfRowsToList(df, par.set, enforce.col.types = FALSE, ...)

dfRowToList(df, par.set, i, enforce.col.types = FALSE, ...)

Arguments

df

(data.frame)
Data.frame, potentially from OptPathDF(). Columns are assumed to be in the same order as par.set.

par.set

ParamSet
Parameter set.

enforce.col.types

(logical(1))
Should all df columns be initially converted to the type returned by getParamTypes(df, df.cols = TRUE). This can help to work with “non-standard” data.frames where the types are slightly “off”. But note that there is no guarantee that this will work if the types are really wrong and there is no naturally correct way to convert them. Default is FALSE.

...

(any)
Arguments passed to BBmisc::convertDataFrameCols()

i

(integer(1))
Row index.

Value

list. Named by parameter ids.


ParamHelpers documentation built on July 4, 2022, 5:07 p.m.