There are times when putting reusable code in your own personal R package is useful — saving yourself time by structuring repetitive tooling, sharing difficult or specific implementations of hard problems to help others hate life less, etc.
This is kind of just a one off — and doesn’t fit in either of those two categories — but I thought I’d share it here, since I’ll probably eventually come back to it and I think it could be useful for others.
Sometimes you just want to load bash scripts in R — in my particular current case, mainly just to load environment variables from my
.bash_profile — like for cron, running scripts in a cluster, etc. But I don’t want to pass them as arguments to some script, and it doesn’t seem like runr is doing what I want (yet).
So this is a snippet that will load environment variables.
It’d be nice if it would load other nice
bash-y things, like functions, aliases, etc., and somehow made them available in the current session, but that might also be unnecessary. (That is, I haven’t yet found it necessary…)