diff --git a/src/TidierData.jl b/src/TidierData.jl index 154ed22d..ce5af439 100644 --- a/src/TidierData.jl +++ b/src/TidierData.jl @@ -23,6 +23,9 @@ export TidierData_set, across, desc, n, row_number, starts_with, ends_with, matc const code = Ref{Bool}(false) # output DataFrames.jl code? const log = Ref{Bool}(false) # output tidylog output? (not yet implemented) +# Expose the global do-not-vectorize "list" +const not_vectorized = Ref{Vector{Symbol}}([:Ref, :Set, :Cols, :(:), :∘, :lag, :lead, :ntile, :repeat, :across, :desc, :mean, :std, :var, :median, :first, :last, :minimum, :maximum, :sum, :length, :skipmissing, :quantile, :passmissing, :cumsum, :cumprod, :accumulate]) + # Includes include("docstrings.jl") include("parsing.jl") diff --git a/src/parsing.jl b/src/parsing.jl index 3fc2c809..67861b5d 100644 --- a/src/parsing.jl +++ b/src/parsing.jl @@ -307,7 +307,7 @@ function parse_autovec(tidy_expr::Union{Expr,Symbol}) elseif @capture(x, fn_(args__)) # This is the do-not-vectorize "list" # `in` should be vectorized so do not add to this exclusion list - if fn in [:Ref :Set :Cols :(:) :∘ :lag :lead :ntile :repeat :across :desc :mean :std :var :median :first :last :minimum :maximum :sum :length :skipmissing :quantile :passmissing :cumsum :cumprod :accumulate] + if fn in not_vectorized[] return x elseif contains(string(fn), r"[^\W0-9]\w*$") # valid variable name return :($fn.($(args...)))