opt_binary_brute: selects columns from a data frame using an optimization...

Description Usage Arguments Examples

View source: R/util.r

Description

The optimization function is called with the data frame x and the names of each combination of the names of x's columns. An example of real-world usage is to automate selection of columns according to the optimization function.

Usage

1
opt_binary_brute(x, fun = opt_binary_fun, verbose = FALSE)

Arguments

x

data frame

fun

function which takes parameters x = data.frame, n = columns

verbose

single logical value, if TRUE then produce verbose messages

Examples

1
2
3
4
5
6
j <- data.frame(a = 1:5, b = 6:2, c = c(0, 2, 4, 6, 8))
opt_binary_brute(j)
j[1, 1] <- NA
j[1:4, 2] <- NA
my_opt_fun <- function(x, n) sum(!unlist(lapply(x, is.na)))
opt_binary_brute(j, fun = my_opt_fun)

jackwasey/jwutil documentation built on Jan. 20, 2020, 6:56 p.m.