OK, any reason why ggplot2 does not allow filtering of NA?


ottar

On 6 November 2010 15:23, Jeff Newmiller <jdnewmil@dcn.davis.ca.us> wrote:

> Create a subset of your data that excludes the NAs before you feed it to
> ggplot.
>
> "Ottar Kvindesland" <ottar.kvindesland@gmail.com> wrote:
>
> >Hi list,
> >
> >I just got stuck with this one:
> >
> >In Data I have the sets age (numbers 1 to 99 and NA) and gender (M, F
> >and
> >NA). Then getting some nice plots using
> >
> >ggplot(data, aes(age[na.exclude(gender)])) +
> >geom_histogram( binwidth = 3, aes(y = ..density.. ), fill = "lightblue"
> >)
> >+
> >  facet_grid( gender ~ .)
> >
> >I am trying to get a faceted graph of age distribution excluding the NA
> >data
> >for gender
> >
> >Unfortunately I end up with the error message:
> >
> >Error in data.frame(..., check.names = FALSE) :
> >arguments imply differing number of rows: 206, 219
> >
> >How do i Wash out NA's in this situation?
> >
> >
> >Regards
> >
> >ottar
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >R-help@r-project.org mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
> Go...
>                                      Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>

	[[alternative HTML version deleted]]

