Hello,
I have a large dataset of the form

subj   var1   var2   
001    100    200
001    120    226
001    130    238
001    140    245
001    150    300
002    110    205
002    125    209
003    101    233
003    115    254

I would like to perform linear regression of var2 on var1 for each subject
separately. It seems like I should be able to use the tapply function as you
do for simple operations (like finding a mean of var1 for each subject), but
I am not sure of the correct syntax for this. Is there a way to do this?

Many thanks, Marcel

--
View this message in context: 
http://r.789695.n4.nabble.com/linear-regression-in-a-ragged-array-tp3393033p3393033.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.

Reply via email to