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

Implement geom_parallel_slopes() #55

Merged
merged 6 commits into from Nov 3, 2019

Conversation

echasnovski
Copy link
Contributor

This PR implements a {ggplot2} layer function for fitting and plotting parallel slopes model. It is as similar to geom_smooth() as reasonably possible. It also has the ability to fit non-linear models (as shown in examples).

Closes #26.

@echasnovski
Copy link
Contributor Author

I updated '.travis.yml' to not run {vdiffr} tests on old release. They are both redundant and currently have issues with different random generation algorithm. This is currently a problem because I set up tests for geom_parallel_slopes() with some random generation. If you want to preserve {vdiffr} tests on R old release, tell me and I'll redo tests with different (determenistic) example data set.

@codecov-io
Copy link

codecov-io commented Nov 3, 2019

Codecov Report

Merging #55 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #55   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           3      4    +1     
  Lines         148    186   +38     
=====================================
+ Hits          148    186   +38
Impacted Files Coverage Δ
R/geom_parallel_slopes.R 100% <100%> (ø)

Copy link
Member

@rudeboybert rudeboybert left a comment

Choose a reason for hiding this comment

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

Also, please add your name as package ctb and preferred contact method to DESCRIPTION

include:
- r: oldrel
# Don't use vdiffr on old R release
env: VDIFFR_RUN_TESTS=false
Copy link
Member

Choose a reason for hiding this comment

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

interesting

#' output(s) to a \code{ggplot} object. Basically, it fits a unified model with
#' intercepts varying between groups (which should be supplied as standard
#' {ggplot2} grouping aesthetics: \code{group}, \code{color}, \code{fill},
#' etc.).
Copy link
Member

Choose a reason for hiding this comment

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

Could you add a comment that this geom provides functionality that geom_smooth() doesn't?

#' ggplot_viz <- ggplot2::ggplot(
#' example_df,
#' ggplot2::aes(x = log10_size, y = log10_price, color = condition)
#' ) +
Copy link
Member

Choose a reason for hiding this comment

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

After we merge we'll likely polish these a bit to make them more in line with the coding style we've been presenting to students in our intro courses. For example, we don't use dplyr:: but rather load the libraries

@rudeboybert
Copy link
Member

Thanks a bunch! This really great work! Also, I just learned a lot about unit testing in this PR!

@rudeboybert rudeboybert merged commit 01c016d into moderndive:master Nov 3, 2019
@echasnovski
Copy link
Contributor Author

I am really glad this PR was and will be useful. Thank you for a challenging task 👍

@rudeboybert
Copy link
Member

Thank you for doing it on such short notice! Everyone I've shown this to is already excited!

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

Successfully merging this pull request may close these issues.

Plotting parallel slopes model
3 participants