Skip to content

Review {Hmisc} dependency #5230

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

Closed
teunbrand opened this issue Mar 13, 2023 · 4 comments
Closed

Review {Hmisc} dependency #5230

teunbrand opened this issue Mar 13, 2023 · 4 comments

Comments

@teunbrand
Copy link
Collaborator

This issue is mostly prompted by recent CI failures due to the Hmisc package switching to use a few native pipes (more details at harrelfe/Hmisc#159, a PR for a fix might be underway). Since tidyverse packages are expected to support non-native-pipe versions of R (< 4.1.0) up to 2025, it might be best to explore whether ggplot2 can drop Hmisc from the 'Suggests' list.

In addition to the reason above, this paper https://arxiv.org/abs/2208.11674 describes {Hmisc} as a 'heavy parent' package (and off-topic: ggplot2 as a 'hub' package). It might be good for R package ecosystem health if ggplot2 did not depend on {Hmisc} if it is a heavy parent. Moreover, it seems also wise to prevent a similar issue as with the {isoband} package down the line.

As far as I can tell, the {Hmisc} package is needed for the mean_cl_boot(), mean_cl_normal(), mean_sdl() and median_hilow() functions over here:

ggplot2/R/stat-summary.R

Lines 248 to 273 in 04a5ef2

wrap_hmisc <- function(fun) {
function(x, ...) {
check_installed("Hmisc")
fun <- getExportedValue("Hmisc", fun)
result <- fun(x = x, ...)
rename(
data_frame0(!!!as.list(result)),
c(Median = "y", Mean = "y", Lower = "ymin", Upper = "ymax")
)
}
}
#' @export
#' @rdname hmisc
mean_cl_boot <- wrap_hmisc("smean.cl.boot")
#' @export
#' @rdname hmisc
mean_cl_normal <- wrap_hmisc("smean.cl.normal")
#' @export
#' @rdname hmisc
mean_sdl <- wrap_hmisc("smean.sdl")
#' @export
#' @rdname hmisc
median_hilow <- wrap_hmisc("smedian.hilow")

It might not be terribly inconvenient to offer a few homegrown alternatives for these 4 functions. Any thoughts?

@yutannihilation
Copy link
Member

Sorry for noticing this trouble late.

If the intent is just to pass the CI, I think we don't need to desperate to drop Hmisc. In my understanding, the tidyverse's "4 previous versions" rule doesn't mean it maintains all the functionalities including the ones that need the Suggest dependencies. In fact, ggplot2 already gave up some packages on the older versions.

Hmisc=?ignore-before-r=3.6.0,
quantreg=?ignore-before-r=3.6.0,

But, considering we have repeatedly faced such issues caused by the different support policies, it might be a good idea to implement these functions within ggplot2.

@teunbrand
Copy link
Collaborator Author

If the intent is just to pass the CI

It would be nice if we could pass the CI, but I think that is a secondary issue. I think the future-proofing and ecosystem bits are of some importance though.

This probably isn't limited to just {Hmisc}. There are some other suggested packages that I cannot find any (or very limited) code references to (some are mentioned in docs though). Examples of these are {munsell}, {RColorBrewer}, {lattice}, {rpart}, {rgeos}.

And there are suggested packages who are used in code, but whose scope is limited. For example {xml2} is just used in one unit test, {ggplot2movies} or {nlme} is only used in examples, and {multcomp} only has some fortify methods.

Maybe this is all a roundabout way to say that I'm not exactly clear what the suggest dependency policy is 😅

@yutannihilation
Copy link
Member

Yeah, I too am not sure about the policy...

{lattice}

Good catch. It seems lattice is what I forgot to remove on #4079 (it seems lattice was used only for explaining how to translate lattice plots to the ggplot2 code).

@teunbrand
Copy link
Collaborator Author

I'm going to consider this fixed by #5237.

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

No branches or pull requests

2 participants