Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential bug when using log in mutate #141

Open
rgreminger opened this issue Feb 9, 2025 · 3 comments
Open

potential bug when using log in mutate #141

rgreminger opened this issue Feb 9, 2025 · 3 comments

Comments

@rgreminger
Copy link

Hi, it seems like there might be a bug when using @mutate to create a new variable as the log of another one. Below is a simple example for such a case, and the error it produces in the latest release v0.16.5.

using TidierData

df = DataFrame(a = 'a':'e', b = 1.0:5.0);

df = @chain df begin
    @mutate(log_b = log(b)) 
end 

# Error it produces: 
ERROR: MethodError: objects of type Base.RefValue{Bool} are not callable
The object of type `Base.RefValue{Bool}` exists, but no method is defined for this combination of argument types when trying to treat it as a callable object.
@kdpsingh
Copy link
Member

kdpsingh commented Feb 9, 2025

Thanks for reporting - will take a look!

@drizk1
Copy link
Member

drizk1 commented Feb 9, 2025

Looks like this is a temp work around, not sure what the best way to fix the underlying parsing function is, will defer to kdpsingh

julia> df = @chain df begin
           @mutate(log_b = Base.log(b)) 
       end
5×3 DataFrame
 Row │ a     b        log_b    
     │ Char  Float64  Float64  
─────┼─────────────────────────
   1 │ a         1.0  0.0
   2 │ b         2.0  0.693147
   3 │ c         3.0  1.09861
   4 │ d         4.0  1.38629
   5 │ e         5.0  1.60944

@kdpsingh
Copy link
Member

kdpsingh commented Feb 9, 2025

This is definitely a bug. Will aim to fix shortly. Have been meaning to simplify the parsing engine which should resolve bugs of this sort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants