[R] Removing NA in ggplot

2010-11-06 Thread Ottar Kvindesland
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

Re: [R] Removing NA in ggplot

2010-11-06 Thread Jeff Newmiller
Create a subset of your data that excludes the NAs before you feed it to ggplot. Ottar Kvindesland ottar.kvindesl...@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

Re: [R] Removing NA in ggplot

2010-11-06 Thread Ottar Kvindesland
OK, any reason why ggplot2 does not allow filtering of NA? ottar On 6 November 2010 15:23, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote: Create a subset of your data that excludes the NAs before you feed it to ggplot. Ottar Kvindesland ottar.kvindesl...@gmail.com wrote: Hi list, I

Re: [R] Removing NA in ggplot

2010-11-06 Thread Joshua Wiley
On Sat, Nov 6, 2010 at 4:43 PM, Ottar Kvindesland ottar.kvindesl...@gmail.com wrote: OK, any reason why ggplot2 does not allow filtering of NA? It is not so much that ggplot2 does not allow the filtering of NA values, it is that you need to use data from the dataset you specified. By subsetting