yanlinlin82 / ggvenn

Venn Diagram by ggplot2, with really easy-to-use API.
Other
167 stars 25 forks source link

Does not work without tidyverse loaded #12

Closed krassowski closed 3 years ago

krassowski commented 3 years ago

I get various errors when trying to use the package by itself wit ggplot2 loaded, for example:

They go away if I explicitly load entire tidyverse (library(tidyverse)) which is a thing I would prefer to avoid. Wold you please consider declaring the imports that you use, e.g. with @importFrom or manual NAMESPACE curation?

Also, would you consider submitting the package for CRAN? I think it has a great potential because it has the cleanest API from several R packages implementing venn diagrams I looked at.

yanlinlin82 commented 3 years ago

Thank you very much! I'd like to improve the package and submit it to CRAN as you suggested.

yanlinlin82 commented 3 years ago

Hi @krassowski , would you please tell me more details about your using the package without explicitly loading tidyverse? Because I failed to reproduce the error you mentioned.

Here goes my test:

$ R

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]
> ls()
[1] "a"
> a  # the only variable
$`Set 1`
[1] 1 3 5 7 9

$`Set 2`
[1]  1  5  9 13

$`Set 3`
[1] 1 2 8 9

$`Set 4`
[1]  6  7 10 12

> search()  # there are only basic packages
[1] ".GlobalEnv"        "package:stats"     "package:graphics"  "package:grDevices" "package:utils" 
[6] "package:datasets"  "package:methods"   "Autoloads"   "package:base"     
> library(ggvenn)  # when loading `ggvenn`, it will automatically load `dplyr`, `grid` & `ggplot2`
Loading required package: dplyr

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

Loading required package: grid
Loading required package: ggplot2
> a %>% ggvenn(c("Set 1", "Set 2"))  # all things go right
>

By the way, I just submitted a new commit, which added some @importFrom declarations. Could you have a try to see if it solve your problem or not? Thank you!

krassowski commented 3 years ago

For reproduction of the issue use:

df = data.frame(
    'set a'=c(TRUE, FALSE, TRUE, TRUE),
    'set b'=c(TRUE, TRUE, TRUE, TRUE),
    'set c'=c(FALSE, TRUE, FALSE, FALSE),
    'set d'=c(FALSE, FALSE, FALSE, TRUE),
    check.names=FALSE
)

ggvenn::ggvenn(df)

I will check the new version later.

yanlinlin82 commented 3 years ago

Thanks. I can reproduce the error now. I will work on it.

yanlinlin82 commented 3 years ago

The latest commit should be ok now. @krassowski

krassowski commented 3 years ago

Works fine for me indeed. Thank you!

yanlinlin82 commented 3 years ago

Also, would you consider submitting the package for CRAN? I think it has a great potential because it has the cleanest API from several R packages implementing venn diagrams I looked at.

Finally, I have submit 'ggvenn' to CRAN, and it could be installed by 'install.packages("ggvenn")' now. Thank you for your suggestion!