Re: [R] applying math/stat functions to rows in data frame

2007-09-17 Thread Gerard Smits
Hi all, Thanks for the suggestions. I have not yet tried the apply () approach, but have tried to get the indexed version working, so far with limited success. I realize that a transpose, as suggested, would work, but want to avoid that for something simpler. To repeat, the task is to perform

Re: [R] applying math/stat functions to rows in data frame

2007-09-15 Thread Gavin Simpson
On Sat, 2007-09-15 at 09:02 -0700, Gerard Smits wrote: > Hi All, > > There are a variety of functions that can be applied to a variable > (column) in a data frame: mean, min, max, sd, range, IQR, etc. But one their own, these are not equivalents to rowMeans, rowSums etc below. > > I am aware o

Re: [R] applying math/stat functions to rows in data frame

2007-09-15 Thread Marc Schwartz
On Sat, 2007-09-15 at 09:02 -0700, Gerard Smits wrote: > Hi All, > > There are a variety of functions that can be applied to a variable > (column) in a data frame: mean, min, max, sd, range, IQR, etc. > > I am aware of only two that work on the rows, using q1-q3 as example > variables: > > row

Re: [R] applying math/stat functions to rows in data frame

2007-09-15 Thread Robert A LaBudde
At 12:02 PM 9/15/2007, Gerald wrote: >Hi All, > >There are a variety of functions that can be applied to a variable >(column) in a data frame: mean, min, max, sd, range, IQR, etc. > >I am aware of only two that work on the rows, using q1-q3 as example >variables: > >rowMeans(cbind(q1,q2,q3),na.rm=T

[R] applying math/stat functions to rows in data frame

2007-09-15 Thread Gerard Smits
Hi All, There are a variety of functions that can be applied to a variable (column) in a data frame: mean, min, max, sd, range, IQR, etc. I am aware of only two that work on the rows, using q1-q3 as example variables: rowMeans(cbind(q1,q2,q3),na.rm=T) #mean of multiple variables rowSums (cbi