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

Why are Groups with 'NA'-Values dropped in pirateplot? #17

Open
tinu-schneider opened this issue Oct 12, 2016 · 4 comments
Open

Why are Groups with 'NA'-Values dropped in pirateplot? #17

tinu-schneider opened this issue Oct 12, 2016 · 4 comments
Assignees

Comments

@tinu-schneider
Copy link

I have data that has no values for group B (all NA). If I make a pirateplot, the group B is not plottet.

   Group     Year   Value
1      A     2010      10
2      A     2015      15
3      B     2010      NA
4      B     2015      NA
5      C     2010      20
6      C     2015      25

ohne

Is there a possibility that I can include group B? In my case I want to show, that we got no results for group B. And I prefer keeping the values as NA and not changing them to 0.

Here is a minimal example

dat <- data.frame(
       Group = c('A', 'A', 'B', 'B', 'C', 'C'),
        Year  = rep(c('2010', '2015'), 3),
        Value = c(10, 15, NA, NA, 20, 25)
)
yarrr::pirateplot(formula = Value ~  Year + Group, data = dat)
@DominiqueMakowski
Copy link

Hi!
Not sure if it answers your question, but I believe that it is better that yarrr works this way. NA values are not equal to 0 (missing data could, in theory, take any possible value) and usually, we don't want them to be treated as 0's... So in your case if your NA's are actual 0's, I think it would be simpler to change them accordingly...

Cheers 😉

@tinu-schneider
Copy link
Author

Ok - I see. So I tweak the plotting on my own like this.

  • If all values of a group are NA, set one of them to the min value of all other groups
  • plot a white polygon over the added faked values (here group B)
  • add NA to the plot
    bsp

As I mentioned before: I would like to show the fact, that we didn't get any data for group B, in our case this is an important fact that should not be dropped.

Thanks anyway!

@ndphillips
Copy link
Owner

ndphillips commented Oct 13, 2016

@tinu-schneider Yes I see how visualising missing data could be important in some cases (though in others it might be a nuisance...). I'll work on adding a new logical argument called ignore.missing that controls this.

@ndphillips ndphillips self-assigned this Oct 13, 2016
@tinu-schneider
Copy link
Author

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants