Skip to content

superbData fails when called without loading the package with superb::ERROR(22) #9

Description

@achetverikov

superbData looks for CI.mean in the global environment, fails when package is not loaded or only namespace-loaded with requireNamespace

From a fresh R session:

> data(ToothGrowth)
+ superb::superbData(ToothGrowth, BSFactors = c("dose", "supp"), 
+   variables = "len")
superb::FYI: The variables will be plotted in that order: dose, supp (use factorOrder to change).
Error in `superbPlot()`:
! superb::ERROR(22): The function CI.mean is not a known function for error bars. Exiting...

# still fails
> requireNamespace('superb')
+ superb::superbData(ToothGrowth, BSFactors = c("dose", "supp"), 
+   variables = "len")
Loading required namespace: superb
superb::FYI: The variables will be plotted in that order: dose, supp (use factorOrder to change).
Error in `superbPlot()`:
! superb::ERROR(22): The function CI.mean is not a known function for error bars. Exiting...

# after loading with library, the example works
> library(superb)
Warning message:
package ‘superb’ was built under R version 4.5.2 
> data(ToothGrowth)
+ superb::superbData(ToothGrowth, BSFactors = c("dose", "supp"), 
+   variables = "len")
superb::FYI: The variables will be plotted in that order: dose, supp (use factorOrder to change).
$summaryStatistics
  dose supp center lowerwidth upperwidth
1  0.5   OJ  13.23  -3.190283   3.190283
2  0.5   VC   7.98  -1.964824   1.964824
3    1   OJ  22.70  -2.797727   2.797727
4    1   VC  16.77  -1.799343   1.799343
5    2   OJ  26.06  -1.899314   1.899314
6    2   VC  26.14  -3.432090   3.432090
...

Environment:

  • superb 1.0.1
  • R 4.5.1 (Windows)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions