Closed hsonne closed 4 years ago
log_e.coli r_mean r_mean_abs_1 r_mean_abs_2 r_mean_abs_3 r_mean_abs_4
1 1.176091 0.08004271 0.000000 0.0000000 0 0.0000000
2 1.176091 0.00000000 0.000000 0.0000000 0 0.0000000
3 1.176091 0.32449605 0.000000 0.0000000 0 0.0000000
4 1.176091 0.00000000 0.000000 0.0000000 0 0.1823216
5 1.176091 0.00000000 1.561647 0.3364722 0 0.0000000
6 1.176091 0.32449605 0.000000 1.2479897 0 1.1205912
@wseis Is the problem that all log(e.coli) are the same? Should we check this in advance and return with an according error message?
yes, exactly, I noticed this issue today as well. I thought of adding some small random noise to each measurement, before taking the logarithm to avoid this error. Some like:
log_e.coli <- log10(conc_ec + rnorm (nrow(conc_ec), 0, 5) )
As discussed, I will apply this "random noise" to all E. coli values before any log-calculation. I will use round(rnorm(n, 0, 5))
with n
being the number of E. coli values.
correction , please reduce the standard deviation to 2. Taking 5 might actually have larger effects than expected because of the log10 scale
The code below currently leads to the following error:
Code to reproduce the error: