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

add labels to prcomp object before tidying #265

Merged
merged 6 commits into from Jun 6, 2018

Conversation

corybrunson
Copy link
Contributor

This would fix #254 (see the discussion there for examples).

@alexpghayes
Copy link
Collaborator

If you pull in the most recent master the (AppVeyor) build should pass. It'd be nice to add a regression test and then I'd be happy to merge.

Conflicts:
	R/prcomp_tidiers.R
@corybrunson
Copy link
Contributor Author

Thanks! I'm having some issues with the build (on a testing branch), but i'll push the merge and see what happens.

@alexpghayes
Copy link
Collaborator

Looks good. Would you add a quick test to make sure that the reprex from before:

library(broom)
test <- as.data.frame(matrix(1:9, ncol = 3) + rnorm(n = 9, sd = 0.25))
test
#>          V1       V2       V3
#> 1 0.7707063 3.870905 7.091106
#> 2 2.3385348 4.987070 7.835155
#> 3 2.6638938 6.006691 8.690749
pca <- prcomp(test)
tidy(pca, matrix = "u")
#> Error in data.frame(label = rep(labels, times = ncomp), samples): arguments imply differing number of rows: 0, 9
test2 

doesn't give an error?

@corybrunson
Copy link
Contributor Author

It works for me!

@corybrunson
Copy link
Contributor Author

Or, did you mean add a test to some part of the PR?

@alexpghayes
Copy link
Collaborator

Yeah I meant add a test to the PR so that if the implementation gets changed in the future the error doesn't return.

@alexpghayes
Copy link
Collaborator

The test current checks that the original reprex fails. We should instead make sure that it passes. I think you want expect_silent, not expect_error. It's weird that that test passed.

@corybrunson
Copy link
Contributor Author

The check uses expect_error() with regexp = NA, indicating that no error should occur, so it should pass. Is there something else wrong?

@alexpghayes
Copy link
Collaborator

Woops, my bad. That's it then. Feel free to add yourself as a contributor in DESCRIPTION!

@alexpghayes alexpghayes merged commit df8b61d into tidymodels:master Jun 6, 2018
@corybrunson corybrunson deleted the prcomp-labels branch Jun 6, 2018
@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 Mar 12, 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.

integer labels for tidy.prcomp() when missing from prcomp object
2 participants