Skip to content

Commit

Permalink
Merge pull request #20 from TidierOrg/expose-not-vectorized-list
Browse files Browse the repository at this point in the history
  • Loading branch information
Karandeep Singh authored Aug 4, 2023
2 parents f0c8877 + 77eaef7 commit 0c62580
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/TidierData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)))
Expand Down

0 comments on commit 0c62580

Please sign in to comment.