[R] applying complex functions by groups

jim holtman jholtman at gmail.com
Mon Jul 14 18:30:31 CEST 2008


can you  provide commented, minimal, self-contained, reproducible
code.  Exactly what statements are you using.  Normally I would use
'split' to partition the data and then 'lapply' to work on each of the
groups.  An idea of what type of processing you have tried and what
your expectation of output (given a specific input) would be.

On Mon, Jul 14, 2008 at 10:39 AM, Finch, W. Holmes <whfinch at bsu.edu> wrote:
> 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
>
> ______________________________________________
> R-help at 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list