[R] applying complex functions by groups

Finch, W. Holmes whfinch at bsu.edu
Mon Jul 14 16:39:52 CEST 2008


Hi,

I have a matrix that is indexed by groups and looks something like this:

1 1 2
1 2 1
.
.
.
2 1 1
2 1 2
2 NA 1
.
.
.
3 1 NA
3 2 NA
etc.

The first column is the group variable and I would like to apply categorical data imputation functions to the other two columns, doing so by groups.  I have tried APPLY, BY and SPLIT, but have not had much luck getting it to work.  I wonder if anyone has suggestions for how I might do this kind of by groups processing.  Thanks very much.

Holmes


Holmes Finch
Associate Professor
Director of Research, Office of Charter School Research
Department of Educational Psychology
Ball State University
Muncie, IN  47306
(765) 285-3668

My favorite quote:

"I was gently accused of escapism during a TV interview about a book I had written on my length-of-California walk. Frankly, I fail to see how going for a six-month, thousand-mile walk through deserts and mountains can be judged less real than spending six months working eight hours a day, five days a week, in order to earn enough money to be able to come back home to a comfortable home in the evening and sit in front of a TV screen and watch the two-dimensional image of some guy talking about a book he has written on a six-month, thousand-mile walk through deserts and mountains."

Colin Fletcher (1922-2007), renowned hiker and outdoor writer



More information about the R-help mailing list