Fork me on GitHub
#data-science
<
2023-02-14
>
aaelony07:02:03

Does anyone know of an R package that can parse EDN into R (e.g. R lists)? something like rjson (https://cran.r-project.org/web/packages/rjson/rjson.pdf) ?

Daniel Slutsky08:02:38

had some experience in the past shelling out to @U04V15CAJ's https://github.com/borkdude/jet for that • Jet can convert EDN to JSON • then you can use R's jsonlite package to turn that into R data structures

aaelony18:02:19

thank you for that. My motivation though, is to use edn instead of json. I will keep looking, but if such a package does not exist, I might write one.

aaelony18:02:31

btw, jet is pretty great!

aaelony18:02:00

wondering if it's worth being a needed dependency though

Daniel Slutsky20:02:36

nice. so you'd like to reproduce what jsonlite does, but with EDN instead of JSON? (at least in one direction, EDN->R, while possibly not needing the other direction?)

Daniel Slutsky20:02:20

you may find this paper by Jeroen Oooms useful, quite detailed and thoughtful in sharing their design decisions and challenges: https://arxiv.org/pdf/1403.2805.pdf

Daniel Slutsky20:02:31

one possible shortcut would be to pass through JSON format: EDN->JSON->R. probably that would be the easy way. if you need to avoid Jet for some reason, then maybe you would like to call Clojure from R. here is an example project demonstrating that: https://github.com/scicloj/tutorials/tree/master/interop/calling-clojure-from-R (but that would introduce other dependencies, such as rJava)

Daniel Slutsky05:02:14

Sounds wonderful