Skip to content

na.rm have no effect in geom_col with position_stack #3532

Description

@dracodoc

Usually na.rm = TRUE will hide the warnings of removing NAs. However when using position_stack with geom_col, the warning cannot be turned off.

df <- data.frame(x = 1:20, value = c(rep(NA, 10), rep(2, 10)))
# this don't have warnings
ggplot(df, aes(x, value)) +
  geom_point(na.rm = TRUE)

# this have warnings
ggplot(df, aes(x, value)) +
  geom_col(na.rm = TRUE)
# Warning message:
# Removed 10 rows containing missing values (position_stack). 

It seemed that the other usage of remove_missing in geom_* take the na.rm parameter, but position_stack doesn't take it as parameter thus no way to hide the warning. Maybe position_stack was supposed to take cleaned data from geom_col too.

R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

ggplot2_3.2.1

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorpositions 🥇

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions