Hello R-help list,

I would really appreciate help with my factoring problem.

My generated data is this:

df <- expand.grid(T=seq(10,80, by=5), conc=rep(c(1, 3, 7), 2))
df$curve <- as.factor(rep(1:6, each=length(seq(10,80, by=5))))
df$counts <- 3*df$T/df$conc + rnorm(df$T,0,2)

plot(counts~T, df)


What I would like to do add a new column to the dataframe of zeroed
data (say df$counts.zeroed). For each curve (designated by factor
df$curve) I want to take the value in counts and subtract the minimum
value for that curve. However, I don't really have an idea of how to
approach this problem and haven't found anything in my searches.

And just as a second question, my second line of code assigns the
factors, but if there is a nicer way of doing this I would really
appreciate knowing how.

Thanks for any help!
Carly

______________________________________________
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