Its the equivalent to across2x and over2x when an object (vector or list) is supplied to .y
It behaves different, when a function is supplied to .y. In this case the function in .y is applied on all columns in .xcols an the functions in .fns are applied to the resulting return object (of the function in .y being applied to all .xcols).
The behavior in 2. is helpful when creating dummy variables and unique() or dist_values is supplied to .y. However, since the functionality is quite different from what crossover does normally this behavior should be implemented in a separate function, mabye called crossfun().
Further, when a vector or list is supplied to .y then the behavior of crossover resembles to across2x and over2x. Therefore, the current function should be renamed to crossoverx(). I considered this once, but refrained from this naming convention, since it is hard to read and decipher compared to across2x and over2x where we have 2 as a separator. Still at the moment there is no equivalent of crossover to over2 or across2. Originally I thought that this functionality is not much needed, and maybe this really is the case, but introducing a different behavior under a similar name is likely to confuse users. So even if a new sequential crossover might not be used very often, it should still exist and the current function should be renamed to crossoverx, while the .y argument accepting function should be put into a separate function ( crossfun).
At the moment
crossover
has two functionalities:across2x
andover2x
when an object (vector or list) is supplied to.y
.y
. In this case the function in.y
is applied on all columns in.xcols
an the functions in.fns
are applied to the resulting return object (of the function in .y being applied to all.xcols
).The behavior in 2. is helpful when creating dummy variables and
unique()
ordist_values
is supplied to.y
. However, since the functionality is quite different from whatcrossover
does normally this behavior should be implemented in a separate function, mabye calledcrossfun()
.Further, when a vector or list is supplied to
.y
then the behavior ofcrossover
resembles toacross2x
andover2x
. Therefore, the current function should be renamed tocrossoverx()
. I considered this once, but refrained from this naming convention, since it is hard to read and decipher compared toacross2x
andover2x
where we have2
as a separator. Still at the moment there is no equivalent ofcrossover
toover2
oracross2
. Originally I thought that this functionality is not much needed, and maybe this really is the case, but introducing a different behavior under a similar name is likely to confuse users. So even if a new sequentialcrossover
might not be used very often, it should still exist and the current function should be renamed tocrossoverx
, while the.y
argument accepting function should be put into a separate function (crossfun
).