[R] [ggplot2] Densityplot, grouping and NAs

Bernd Weiss bernd.weiss at uni-koeln.de
Wed Mar 25 11:09:31 CET 2009


ONKELINX, Thierry schrieb:
> Dear Bernd,
> 
> Omitting the NA values from the dataset will work.
> 
> ggplot(aes(x = x, color = g), data = na.omit(mydf)) + geom_density() 

Dear Thierry,

thanks for your reply! Of course, regarding my little toy example 
na.omit() perfectly works. However, my real data set consists of 
hundreds of variables. So, one has to write

... data = na.omit(myHugeDataset[,c("var1","var99","var208")]) ...

Bernd




More information about the R-help mailing list