On Mon, Sep 12, 2011 at 3:42 AM, marcel <marcelcur...@gmail.com> wrote: > I have data of the form > > tC <- textConnection(" > Subject Date parameter1 > bob 3/2/99 10 > bob 4/2/99 10 > bob 5/5/99 10 > bob 6/27/99 NA > bob 8/35/01 10 > bob 3/2/02 10 > steve 1/2/99 4 > steve 2/2/00 7 > steve 3/2/01 10 > steve 4/2/02 NA > steve 5/2/03 16 > kevin 6/5/04 24 > ") > data <- read.table(header=TRUE, tC) > close.connection(tC) > rm(tC) > > I am trying to calculate rate of change of parameter1 in units/day for each > person. I think I need something like:
Try this: data$Date <- as.Date(data$Date, "%m/%d/%y") fm <- lm(parameter1 ~ Subject / Date - 1, data) coef(fm) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.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.