Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

step_dummy: separator option for naming #183

Closed
mdancho84 opened this issue Aug 16, 2018 · 7 comments
Closed

step_dummy: separator option for naming #183

mdancho84 opened this issue Aug 16, 2018 · 7 comments

Comments

@mdancho84
Copy link

Max,

Loving working with this package. One thing I run into from time to time is to associate the dummy variable with the original variable name. It might make things easier if you include a separator option similar to stringr::str_c(sep = "_") for the step_dummy() function.

It would make it easy to str_split() the base name from the appended dummy piece of the name.

Let me know if you agree.

Thanks, Matt

@topepo
Copy link
Member

topepo commented Aug 16, 2018

Would the names argument to step_dummy solve this? It defaults to:

recipes::dummy_names <- function (var, lvl, ordinal = FALSE) {
    if (!ordinal) 
        nms <- paste(var, make.names(lvl), sep = "_")
    else nms <- paste0(var, names0(length(lvl), "_"))
    nms
}

but you could pass your own function.

@topepo
Copy link
Member

topepo commented Sep 10, 2018

Should I close this? Does it work for you?

@mdancho84
Copy link
Author

Sorry, I missed this in my email. If we could access the sep = "_" as an argument to recipes::dummy_names and then connect that to the step_dummy() function either as a explicit argument or passed as ... to the underlying function. That would be ideal.

@mdancho84
Copy link
Author

I can work up a PR hopefully next week. With Jonathan at S&P this week. Also congrats on the Davis hire. He's a great add, and he'll be a big benefit to your team.

@topepo topepo closed this as completed in 49b2a34 Sep 11, 2018
@topepo
Copy link
Member

topepo commented Sep 11, 2018

That's simple enough; done.

Yeah, Davis is great. I feel like we have 4 people instead of 2.5.

@mdancho84
Copy link
Author

Awesome man! Appreciate it. That's going to make Correlation Funnels much easier. hehe

exploratory_2_4

Yeah, your team's productivity just skyrocketed.

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants