Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there
TL;DR: This PR makes the following code possible:
Without the need for
as.data.frame(df)
in theggplot()
call.Context:
As per https://community-bioc.slack.com/archives/C6KJHH0M9/p1690235172607369
I've messed around
S4vectors
a bit to test feasibility, and somehow landed on my feet with something that seems to work.I'll be honest, I'm not even sure why R allows me to do it, but it seems that I can
importFrom
a package that is listed inSuggests
(i.e., not inDepends
).I added
ggplot2
toSuggests
because I don't like the idea of having it underImports
. It just feels wrong to automatically installggplot2
and its own dependencies as a dependency ofS4Vectors
.S4Vectors
should remain a lightweight package.I suppose that if users have
ggplot2
installed, the import statement "just works", and if they don't haveggplot2
installed.. well... they don't have any reason to callggplot()
on aDataFrame
object :DI'm aware that this PR is unlikely to be the final fix (if any is possible at all). I just aim to give a starting point to the discussion.
Also, I've considered other approaches, but run into chicken-and-egg issues:
ggplot2
will not accept toSuggests: S4Vectors
, as I don't see any Bioconductor package in its existing Imports/Suggests (https://cran.r-project.org/web/packages/ggplot2/index.html) andinstall.packages()
cannot see Bioconductor packages without messing withoptions(repos)
.S4Vectors
will not accept toImports: ggplot2
, to justify more cleanlyimportFrom(ggplot2, fortify)
. Same reason as above: keep S4Vectors dependencies to a minimum?ggplot2::fortify
states "Rather than using this function, I now recommend using the broom package, which implements a much wider range of methods. fortify() may be deprecated in the future." However, it is not clear to me what needs to be done in broom (or biobroom)