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

cj(..., by = ) operations produce faulty results when by factor has blank levels #32

Open
leeper opened this issue Apr 14, 2020 · 0 comments
Labels
bug

Comments

@leeper
Copy link
Owner

@leeper leeper commented Apr 14, 2020

Please specify whether your issue is about:

  • a possible bug
  • a question about package functionality
  • a suggested code or documentation change, improvement to the code, or feature request

Reported by Farsan Ghassim via email:

## load package
library("cregg")

## code goes here
iris$foo <- factor(c("a", "b", ""))
cregg::cj(iris, Sepal.Length ~ Species, estimate = "mm", by = ~ foo)
##   BY      outcome statistic feature      level estimate  std.error        z p    lower    upper foo
## 1    Sepal.Length        mm Species versicolor 6.023529 0.13406704 44.92923 0 5.760763 6.286296   a
## 2    Sepal.Length        mm Species     setosa 4.950000 0.09657727 51.25430 0 4.760712 5.139288   a
## 3    Sepal.Length        mm Species  virginica 6.570588 0.15190449 43.25473 0 6.272861 6.868316   a
## 4  a Sepal.Length        mm Species  virginica 6.756250 0.14368309 47.02189 0 6.474636 7.037864   b
## 5  a Sepal.Length        mm Species     setosa 5.052941 0.09286290 54.41291 0 4.870933 5.234949   b
## 6  a Sepal.Length        mm Species versicolor 5.770588 0.12793126 45.10694 0 5.519848 6.021329   b

## session info for your system
sessionInfo()
@leeper leeper added the bug label Apr 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.