>>>>> Mike Smith <m...@hsm.org.uk> >>>>> on Sun, 1 May 2016 08:15:44 +0100 writes:
>>>> On Apr 30, 2016, at 12:58 PM, Mike Smith >>>> <m...@hsm.org.uk> wrote: Hi >>>> First post and a relative R newbie.... >>>> I am using the vioplot library to produce some violin >>>> plots. DW> It's a package, .... not a library. [yes!] >>>> 1. Is there a more elegant way of automatically >>>> stripping the NAs, passing the columns to the function >>>> along with the header names?? >>> ds2 <- lapply( ds1, na.omit) > Fantastic - that does the trick! Easy when you know how!! > Follow-on: is there a way feed all the lists from ds2 to > vioplot? It is now a series of lists (rather than a > dataframe - is that right?). Yes, that's right. So after all the above was not really perfect : na.omit() has been designed as a generic function and has always had a method for "data.frame"; so, really ds.noNA <- na.omit(ds1) or ds0NA <- na.omit(ds1) (choosing "expressive names") is what you want. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.