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 · 6 comments
Closed

step_dummy: separator option for naming #183

mdancho84 opened this issue Aug 16, 2018 · 6 comments

Comments

@mdancho84
Copy link

@mdancho84 mdancho84 commented Aug 16, 2018

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
Collaborator

@topepo 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
Collaborator

@topepo topepo commented Sep 10, 2018

Should I close this? Does it work for you?

@mdancho84
Copy link
Author

@mdancho84 mdancho84 commented Sep 11, 2018

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

@mdancho84 mdancho84 commented Sep 11, 2018

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 in 49b2a34 Sep 11, 2018
@topepo
Copy link
Collaborator

@topepo 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

@mdancho84 mdancho84 commented Sep 12, 2018

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

exploratory_2_4

Yeah, your team's productivity just skyrocketed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.