Re: [R] implementing Grubbs outlier test on a large dataframe

2009-02-14 Thread Frank E Harrell Jr
John Malone wrote: Hi! I'm trying to implement an outlier test once/row in a large dataframe. Ideally, I'd do this then add the Pvalue results and the number flagged as an outlier as two new separate columns to the dataframe. Grubbs outlier test requires a vector and I'm confused how to make ea

Re: [R] implementing Grubbs outlier test on a large dataframe

2009-02-14 Thread David Winsemius
Sending each row of a datatframe, dfm, as a vector to a function, fcn, is as simple as; apply(dfm, 1, fcn) e.g.: > dfm <- data.frame(x=rnorm(10), y=rnorm(10), z=rnorm(10)) > > apply(dfm, 1, sum) [1] 0.7385838 -3.1819193 0.3415670 -0.6552601 -1.3470174 -0.6446259 -0.6544967 [8] 0.1778

[R] implementing Grubbs outlier test on a large dataframe

2009-02-14 Thread John Malone
Hi! I'm trying to implement an outlier test once/row in a large dataframe. Ideally, I'd do this then add the Pvalue results and the number flagged as an outlier as two new separate columns to the dataframe. Grubbs outlier test requires a vector and I'm confused how to make each row of my datafram