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
use ldply instead of lapply to tidy aovlist's #377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this PR! I made a couple comments on the code, but this looks great overall.
R/anova_tidiers.R
Outdated
function(a) dplyr::mutate(ret[[a]], stratum = a) | ||
) | ||
ret <- do.call("rbind", ret) | ||
ret <- plyr::ldply(x, tidy, .id = "stratum") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're looking to move away from plyr
at the moment. Would you be willing to use purrr
here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me. I'll switch it up.
R/anova_tidiers.R
Outdated
#' | ||
#' @importFrom plyr ldply | ||
#' | ||
#' @import dplyr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dplyr
and plyr
get imported package-wide in DESCRIPTION, so I believe these aren't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I'll remove them.
@@ -0,0 +1,15 @@ | |||
context("anova tidiers") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regression tests! Awesome!
tests/testthat/test-anova.R
Outdated
|
||
test_that("tidy.aovlist works"){ | ||
aovlistfit <- aov(mpg ~ wt + disp + Error(drat), mtcars) | ||
td <- suppressWarnings(tidy(aovlistfit)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of warnings are getting suppressed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and there actually are none. Warning suppression was just a hold over from copying the format of the test-lm.R
. I'll take it out
Don't worry about the build failure at the moment, BTW, that's my fault and I need to fix it. |
…ressions from tests
Changes look good. Will merge as soon as I sort out the |
Okay, think we're good to merge. Feel free to add yourself as a contributor to |
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. |
this changes the way tidy is used to tidy aovlist's (such as within-subject error structures) to close issue #299