Douglass.jl
Douglass.jl copied to clipboard
row-wise `if`
It seems like it would be nicer to have if as a row-wise operation.
That is, instead of:
d"generate :x = :SepalWidth + :PetalLength if :PetalLength .> 1.3"
d"bysort :Species (:SepalLength) : generate :x = :SepalWidth + :PetalLength if :PetalLength .> 1.3"
d"bysort :Species (:SepalLength) : egen :x = mean(:PetalWidth) if :SepalWidth .< 3.4"
have
d"generate :x = :SepalWidth + :PetalLength if :PetalLength > 1.3"
d"bysort :Species (:SepalLength) : generate :x = :SepalWidth + :PetalLength if :PetalLength > 1.3"
d"bysort :Species (:SepalLength) : egen :x = mean(:PetalWidth) if :SepalWidth < 3.4"
Agreed.
I think it is possible to override all binary operators with their elementwise counterparts. There must be a macro for that.