Hi clsnyder, You forgot the MARGIN argument in you function call. Take a look at ?apply
apply(iris, 2, length) apply(iris, 2, mean) HTH, Jorge * * On Sat, Sep 17, 2011 at 6:42 PM, clsnyder <> wrote: > Why does one method work, and the other not? > > attach(iris) > head(iris) > > mean(Sepal.Length) > [1] 5.843333 > > apply(iris, Sepal.Length, mean) > "Error in if (d2 == 0L) { : missing value where TRUE/FALSE needed" > > I seem to get this error frequently with the apply functions but other > "manual" methods work normally on the same data. > > TIA > > -- > View this message in context: > http://r.789695.n4.nabble.com/apply-question-tp3821122p3821122.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > [[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.