I was trying to create my own features with multiple variables. Is it possible? The goal is to apply a function to multiple variables and get one variable in the end.
This is an example where I expected a sum of two columns to be returned.
library(brolgar)
library(dplyr)
feat_tot <- function(x, y, ...){
c(
tot = sum(x, y)
)
}
wages %>%
features_at(.var = vars("ln_wages", "xp"),
features = feat_tot)
#> Warning: 888 errors (1 unique) encountered for feature 1
#> [888] argument "y" is missing, with no default
#> Warning: 888 errors (1 unique) encountered for feature 2
#> [888] argument "y" is missing, with no default
#> # A tibble: 888 x 1
#> id
#> <int>
#> 1 31
#> 2 36
#> 3 53
#> 4 122
#> 5 134
#> 6 145
#> 7 155
#> 8 173
#> 9 206
#> 10 207
#> # ... with 878 more rows
Following my twit, I'm submitting an issue.
I was trying to create my own
features
with multiple variables. Is it possible? The goal is to apply a function to multiple variables and get one variable in the end.This is an example where I expected a
sum
of two columns to be returned.