You can use the function subset
inside ggplot2
. Try this
library(ggplot2)
data("iris")
iris$Sepal.Length[5:10] <- NA # create some NAs for this example
ggplot(data=subset(iris, !is.na(Sepal.Length)), aes(x=Sepal.Length)) +
geom_bar(stat="bin")
More Related Contents:
- Conditionally change panel background with facet_grid?
- ggplot2 keep unused levels barplot
- Editing legend (text) labels in ggplot
- How to order data by value within ggplot facets
- plotting smooth line through all data points
- ggplot2 geom_bar – how to keep order of data.frame [duplicate]
- Extract data from a ggplot
- ggplot2: Curly braces on an axis?
- pass function arguments to both dplyr and ggplot
- Plotting with ggplot2: “Error: Discrete value supplied to continuous scale” on categorical y-axis
- In ggplot2, what do the end of the boxplot lines represent?
- Add a horizontal line to plot and legend in ggplot2
- How to use subscripts in ggplot2 legends [R]
- ggplot2: How to use same colors in different plots for same factor
- Removing one tableGrob when applied to a box plot with a facet_wrap
- ggplot2 – The unit of size
- Saving grid.arrange() plot to file
- How to plot a Stacked and grouped bar chart in ggplot?
- Overlay two ggplot2 stat_density2d plots with alpha channels
- Sort legend in ggplot2
- ggplot: Boxplot of multiple column values [duplicate]
- Drawing a barchart to compare two sets of data using ggplot2 package?
- Plotting multiple graphs in R [closed]
- How to set legend alpha with ggplot2
- Changing format of some axis labels in ggplot2 according to condition [duplicate]
- ggplot2 – using two different color scales for overlayed plots
- Spacing between boxplots in ggplot2
- Add axis tick-marks on top and to the right to a ggplot?
- Creating a vertical color gradient for a geom_bar plot
- heatmap-like plot, but for categorical variables