Notice the above gives an incorrect result: all of the
x_icolumns are identical, and all of the
y_icolumns are identical. I am not saying the above code is in any way desirable (though something like it does arise naturally in certain test designs). If this is truly “incorrect
dplyrcode” we should have seen an error or exception. Unless you can be certain you have no code like that in a database backed
dplyrproject: you can not be certain you have not run into the problem producing silent data and result corruption.
The issue is:
dplyron databases does not seem to have strong enough order of assignment statement execution guarantees. The running counter “
delta” is taking only one value for the entire lifetime of the
dplyr::mutate()statement (which is clearly not what the user would want).
Read on for a couple of suggested solutions.