Closed genmeblog closed 4 years ago
We have two places where R symbol conversion is applied.
Both keys and symbols can be invalid in various ways in Clojure so proper conversion should be made.
Strategy is:
"[[<-.factor"
brabra
For both cases we use #"[\Q[](){}#@;:,\/^'~\"\E].*"` which catches only first letter as forbidden letter.
#"[\Q[](){}#@;:,\/
Two regexes should be prepared for each cases separately and tested against real names taken from R libraries (mainly base).
base
Related discussion:
https://clojurians.zulipchat.com/#narrow/stream/204621-r-interop/topic/names
https://clojurians.zulipchat.com/#narrow/stream/204621-r-interop/topic/access.20to.20dataframes
I think it should be still open since it doesn't catch different cases like this:
(->> "list(A=1,B=2,'123#strange<text> ()'=3)" r r->clj) ;; => {:A [1.0], :B [2.0], :123#strange<text> () [3.0]}
We have two places where R symbol conversion is applied.
Both keys and symbols can be invalid in various ways in Clojure so proper conversion should be made.
Strategy is:
"[[<-.factor"
) or wrap into dedicated function (likebrabra
)For both cases we use
#"[\Q[](){}#@;:,\/
^'~\"\E].*"` which catches only first letter as forbidden letter.Two regexes should be prepared for each cases separately and tested against real names taken from R libraries (mainly
base
).