scicloj / clojisr

Clojure speaks statistics - a bridge between Clojure to R
https://scicloj.github.io/clojisr/
Eclipse Public License 2.0
147 stars 9 forks source link

how to run R operator "%%", "%/", "%in%" #103

Closed behrica closed 1 month ago

behrica commented 1 month ago

could not find them defined in code.

genmeblog commented 1 month ago

It was here: https://github.com/scicloj/clojisr/commit/953338e26ee277bade57264818ffc2fd14aad160

However later it was removed. Since it was used in symbolic DSL you just can use it as a string, ie (r '("%/%" ...))

genmeblog commented 1 month ago

And explicit definition of the operators wrapped in % were removed in beta12 to treat the globally as binary operators: https://github.com/scicloj/clojisr/blob/master/CHANGELOG.md?plain=1#L71

behrica commented 1 month ago

so should we add clojure functions for it ?

we have "rdiv" and other arithmetic functions as well: https://github.com/behrica/clojuress/blob/5a711b485a41199535b913ebca80febb8b297ae9/src/clojisr/v1/r.clj#L209

The help of R puts them as well as the "same thing":

Description:

     These unary and binary operators perform arithmetic on numeric or
     complex vectors (or objects which can be coerced to them).

Usage:

     + x
     - x
     x + y
     x - y
     x * y
     x / y
     x ^ y
     x %% y
     x %/% y
genmeblog commented 1 month ago

%/% is invalid clojure symbol, so %div% should be a replacement.

behrica commented 1 month ago

%/% is invalid clojure symbol, so %div% should be a replacement.

Ok, I check for missing operators and will add them in PR #99