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

Function to create split from dataframes #246

Merged
merged 10 commits into from
Jun 29, 2021
Merged

Function to create split from dataframes #246

merged 10 commits into from
Jun 29, 2021

Conversation

liamblake
Copy link
Contributor

A function split_from_dataframe to create a rsplit object from a training and testing dataframe, making it much easier to use your own data splits. Closes #241. I'm not sure if misc.R is the best place for this function, but chose that file because it contains make_splits. Similarly, the new tests are in test-make-splits.R.

res <- rsplit(data, ind$analysis, ind$assessment)
if (!is.null(class))
res <- rsplit(data, ind$analysis, ind$assessment)
if (!is.null(class)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this change was made by running styler on the file.

@juliasilge juliasilge requested a review from topepo June 24, 2021 23:52
@juliasilge
Copy link
Member

@topepo Can you take a look at this, specifically the way I made make_splits() a generic, with the original function the method for a list and the new function a method for a data.frame?

I was really struggling with the naming for this function 😩 and how similar and confusing all these constructors are, and then I thought, "Wait, these should just be methods." Fortunately, the original function already had the list the first argument.

Copy link
Member

@topepo topepo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. I made a few small changes. The S3 method is a great idea.

@juliasilge
Copy link
Member

Thanks so much for getting this started @liamblake! 🙌

@juliasilge juliasilge merged commit a20b0b3 into tidymodels:master Jun 29, 2021
@github-actions
Copy link

This pull request 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 Jul 14, 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

Successfully merging this pull request may close these issues.

New function to create split from dataframes
3 participants