I created a dataset "before_database" via read.table(). Afterwards this data frame was grouped by do.call() and stored into a object "fits":
fits<-do.call('rbind', by(before_database, before_database$Serial_number, function(before_database) broom::tidy(lm(Amplification ~ Voltage-1, data = before_database))))
Now I want to see some results out of this. Summary(fits) works:
> summary(fits)
term estimate std.error statistic p.value
Length:54 Min. :0.3601 Min. :0.06611 Min. :2.884 Min. :3.000e-09
Class :character 1st Qu.:0.4943 1st Qu.:0.11113 1st Qu.:3.384 1st Qu.:4.344e-05
Mode :character Median :0.5866 Median :0.14816 Median :3.934 Median :2.015e-04
Mean :0.6030 Mean :0.16049 Mean :4.026 Mean :8.918e-04
3rd Qu.:0.7058 3rd Qu.:0.21271 3rd Qu.:4.318 3rd Qu.:1.199e-03
Max. :0.9193 Max. :0.27495 Max. :6.410 Max. :5.291e-03
>
but plot(fits) not. I receive:
> plot(fits)
Error in plot.window(...) : need finite 'xlim' values
In addition: Warning messages:
1: In data.matrix(x) : NAs introduced by coercion
2: In min(x) : no non-missing arguments to min; returning Inf
3: In max(x) : no non-missing arguments to max; returning -Inf
Also coef(fits) seems not to work, I just get "NULL". What is the matter? What do I should go after?
edit: Added the summary info and I've a further question, maybe connected to the issue. I want to fit all the grouped data separately (am I doing this right now?) so by trying to plot it is not specified what shall be plotted exactly (which of the subsets)?
I guess my problem can be reduced to cirumstance that I do not know how I can apply regular r commands to the grouped data/subsets generated via do.call()? In the end I need a specific value out of the fit. I know fitted() can do this but how to do now for each group? E.g. I need the corresponding voltage of an amplification of 150 and the slope at this point.
Grouped & fitted by do.call() (only a part shown):