reddit / emacs
R and Python Polymode Data Science
TibialCuriosity · 2022-11-20 07:28
Hi all,
Does anyone have a configuration or tips in setting up a workflow in emacs that uses python and R?
Would be most interested in a way with polymode but open to all ideas.
Thanks in advance
krypt3c · 2022-11-20 09:36
You can do literate programming (like jupyter notebooks) in orgmode, and include src blocks for arbitrary languages you're working with.
Top-Egg-16 · 2022-11-20 10:15
Have you tried ESS?
TibialCuriosity · 2022-11-20 10:50
Yea! It works well within R though I haven't done any heavy work in it yet and I have it working with markdown and quarto
I'm looking to do something similar with python. Doesn't need to work with R in the same document though that'd be cool. I know R has reticulate but I've hears iffy things about it
leledavid · 2022-11-20 12:29
I've been using RStudio for R + Python via reticulate package and so far i did not have any major problems. All the py objects that you create are accesible to you in R via the \`py\` variable that is in your global environment. Also vice-versa you can get to R objects in your Py session.
I don't think you should have any problems to do the same in Emacs via ESS + reticulate to do R <-> py interaction.
idspispopd0 · 2022-11-20 14:48
Besides reticulate, there's also quarto-mode.
TibialCuriosity · 2022-11-20 19:13
Awesome, I'll give it a shot to see hour if goes
haffnasty · 2022-11-20 19:20
orgmode is great for literate programming but from my experience RMarkdown is a bit better when working mostly with R. Things like templating, xaringan presentations, and hmtlwidgets are all more seamless with RMarkdown.
haffnasty · 2022-11-20 19:25
I'm in academia and spend 90% of my time in RMarkdown documents (xaringan presentations, blogdown, and plain old Rmd docs). I'm using spacemacs but you can view my haggard dotfile here: https://gitlab.com/mhaffner/dotfiles/-/blob/master/.spacemacs
I'd explain what I'm doing in more detail but I have a baby sleeping on my chest right now. Let me know if you want more info and I'll respond later.
jcmkk3 · 2022-11-21 05:33
https://github.com/astoff/comint-mime, python mode, and ipython work well for me. Some combination of markdown mode, polymode, quarto, and jupytext can probably get you pretty far with a literate programming style. There’s also the https://github.com/nnicandro/emacs-jupyter package that might be worth checking out.
TibialCuriosity · 2022-11-23 07:25
Thank you for sharing! Apologies for the delayed response, it's been a hectic few days. I would love a little bit of a rundown as I think it makes some sense but I am quite new to emacs
TibialCuriosity · 2022-11-23 07:28
Thank you for this and apologies for the delayed response. Does the comint-mime work out of the box with quarto? I have got quarto enabled so I do think I should just be able to insert a python chunk and be able to code as normal but I am not a 100% sure