hadley wickham wrote:
I get the following, which is not what I am looking for.
test[1:10,]
expertxx seeds runvalue
1 BW x001025 1 rsqs, slope, d.slope, intercept, d.intercept
2 BW x001025 2 rsqs, slope, d.slope,
Hi
I have the following code which I would like to simplify. Id does linear
regressions and returns the r-squares, and the coefficients.
It runs slow, as it is doing the regressions for each - is it possible
to get the values in a dataframe which looks as follow:
expert | xx | seeds |
Aan: r-help@stat.math.ethz.ch
Onderwerp: [R] simplification of code using stamp?
Hi
I have the following code which I would like to simplify. Id does linear
regressions and returns the r-squares, and the coefficients.
It runs slow, as it is doing the regressions for each - is it possible
to get
: [R] simplification of code using stamp?
I think your script is slow because it has to recalculate the same model
five times. I've tried to avoid this by rewriting your function(df).
function(df){
fit - summary(lm(distance ~ generation, data=df))
result - c(fit$$r.squared
ONKELINX, Thierry wrote:
Resending the function because of a typo in the result vector.
function(df){
fit - summary(lm(distance ~ generation, data=df))
result - c(fit$r.squared, fit$coefficients[2],
fit$coefficients[4],
fit$coefficients[1], fit$coefficients[3])
I get the following, which is not what I am looking for.
test[1:10,]
expertxx seeds runvalue
1 BW x001025 1 rsqs, slope, d.slope, intercept, d.intercept
2 BW x001025 2 rsqs, slope, d.slope, intercept, d.intercept
3