[R] Help with apply and split...

2008-05-02 Thread Mike H. Ryu
I'm trying to drop all rows except for the ones with the most recent year. So I split the data frame by NPERMNO and keep just the last record of all groups. datg=t(sapply(split(datgic, datgic$NPERMNO, drop=TRUE), function(x){return( x[nrow(x),] )})) I get something like this... GVKEY

[R] Running regression (lm, lrm) 100+ times and saving the results as matrix

2008-04-29 Thread Mike H. Ryu
An undergraduate here, so do not hesitate to let me know if you feel that I'm heading in a wrong direction. I have a data frame containing panel data across 10 years (hence 120 months). I want to be able to run regression separately for each month (or year). The below shows how I ran the

Re: [R] Running regression (lm, lrm) 100+ times and saving the results as matrix

2008-04-29 Thread Mike H. Ryu
, mydf$TIME), function(x){coefficients(summary(glm(X ~ A + B, data = x, family=binomial)))}) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike H. Ryu Sent: Tuesday, April 29, 2008 7:27 AM To: r-help@r-project.org Subject: [R] Running regression (lm, lrm