You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: content/posts/2025-03-01-r-usability-gimmicks/index.markdown
+5-6
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,11 @@ toc: yes
15
15
math: no
16
16
---
17
17
18
-
The other day I [posted on Mastodon about shell script wrappers for common R commands](https://norden.social/@jemsu/114078735407359852).
19
-
20
-
And I thought I might as well flesh this out a little.
21
-
So for context, I should note that in my everyday computing setup, I have configured my terminal [iTerm2] as a hotkey window, meaning that whichever desktop space I'm on and whatever application is currently in focus, I just have to press <kbd>F2</kbd> to pop down my terminal window.
18
+
The other day I [posted on Mastodon about shell script wrappers for common R commands](https://norden.social/@jemsu/114078735407359852) and I thought I might as well flesh this out a little.
19
+
So for context, I should note that I have configured my terminal [iTerm2] as a hotkey window, meaning that whichever desktop space I'm on and whatever application is currently in focus, I just have to press <kbd>F2</kbd> to pop down my terminal window.
22
20
That means that "quickly running a shell command" is a very easy and natural part of my computing experience --- and I guess what I'm talking about here is only useful to you if using the terminal feels similarly natural to you.
23
21
24
-
Secondly, I should note that my bash scripting skills are a hodgepodge of just over a decade of googling around, trial-and-erroring until it works(ish), and more recently, just asking an LLM to fix my shitty scripts.
22
+
Secondly, my bash scripting skills are a hodgepodge of just over a decade of googling around, trial-and-erroring until it works(ish), and more recently, just asking an LLM to fix my shitty scripts.
25
23
Writing neat little wrappers for things is basically my way of practicing and trying out different bits and bops, so feel free to suggest better or more flexible approaches.
26
24
That being said, I should also point out that using `Rscript` and / or {{< pkg "littler" >}} are perfectly fine options to write scripts using plain R, and the more I think about it the more it becomes obvious that taking a bash detour is kind of pointless for these things, but... oh well.
27
25
Let's get to it.
@@ -63,6 +61,7 @@ result="${result%, })"
63
61
printf"Installing packages: %s\n""$*"
64
62
Rscript --quiet -e "pak::pak(${result})"
65
63
```
64
+
66
65
The only complicated part is parsing positional arguments into a character vector, which ended up needing some freshening up on my bash foo, but otherwise it's fairly straightforward.
67
66
68
67
The usage is simple:
@@ -81,7 +80,7 @@ I should also probably point out that another way to quickly install a package o
81
80
82
81
[^rignote]: and [rig] for that matter, but that's a different blog post.
83
82
84
-
[^hpc]: Let's say that as someone who regularly works with HPC systems runnong on RedHat Enterprise Linux, I have come to _really_ appreciate being able to get binary R packages in some cases where system dependencies would have otherwise made compilation from source a huge pain
83
+
[^hpc]: Let's say that as someone who regularly works with HPC systems running on RedHat Enterprise Linux, I have come to _really_ appreciate being able to get binary R packages in some cases where system dependencies would have otherwise made compilation from source a huge pain
0 commit comments