

Discover more from hrbrmstr's Daily Drop
R 4.2 Released
Last Friday was a big day in R-land. With a version bump to 4.2, the latest R language release was dropped into this cold, cruel world to brighten our days and give us some new toys to play with.
I won't burden the casual reader with a deep dive (the link, above, has all the gory details), but will highlight two-ish great new features that I shall be making great use of.
The first is an enhancement to the native pipe (e.g. |>
) functionality.
R's new native pipe is an alternative to the {magrittr} pipe (%>%
) which has been popularized by R's {tidyverse} family of packages. Said family uses a "data first" concept to organize data manipulation and analysis workflows into, well, a pipes and filters design pattern. Pipes remove the need for confusing and error-prone nested parenthesis and helps coders organize workflows into an obvious processing chain. An example might help:
LETTERS |>
gsub("L", "ELL", x = _)
## [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J"
## [11] "K" "ELL" "M" "N" "O" "P" "Q" "R" "S" "T"
## [21] "U" "V" "W" "X" "Y" "Z"
The gsub()
function is not "data first". It puts the pattern
and replacement
parameters before the data being acted upon (x
in this case, which is a way overused parameter name idiom in {base} R).
Prior to this new, standard placeholder, one had to do some hackish stuff to make the native R pipe work like the {magrittr} pipe, with it's .
placeholder.
The new placeholder means I (and you) can rely on the base pipe over the {magrittr} pipe and reduce some external dependencies for a certain class of projects.
A second new (experimental) addition is hash tables (use ?hashtab
at an R 4.2 console to bring up the help on this new feature). Prior to proper hash table support, R folk could use ?environment
s to mimic the functionality of a key/value-based lookup idiom in just base R (and, there are many packages that implement hash tables). This dedicated new functionality is faster (in certain contexts) and more general purpose than what many of us have relied on for years.
You can see it in action via another new feature: a significant enhancement to R help/manual pages:
That "run examples" link is new and does quite a bit when you select it:
The examples actually run and produce output similar to familiar R Markdown or Jupyter notebook results, which is a great improvement that may just get new (and old, like me) R folks to actually RTFM.
Since I'm trying to be programming language agnostic in this newsletter, I'll dig in the trash heap to see if there's anything useful in Python (et al) land in an upcoming installment.
Again, make sure to check out all the new toys we have to play with in R-land.
Map Projection Playground
As I'm the consummate map nerd, any time there's a new way to play with map projections, count me in!
Florian Ledermann (@floledermann) has an incredibly addictive Observable notebook that lets you play with (almost) every known [world] projection.
We'll spend some quality time discussing the Observable platform, soon, but until then, I highly suggest you spend some similar quality time in Florian's playground. If said exercise accomplishes nothing else, it may help you realize that what we consume with our eyes may not always be "accurate", at least not in all respects, since the above "conic equal area" projection represents the same Earth as this Berghaus' star projection:
Fresh[er] Meat
Back in my day we had no Twitter to help us keep up-to-date on the latest cool projects/software being birthed into the ether. We had Freshmeat, and we liked it, gosh darn it.
Freshmeat was, for a time, the way to stay current if you were a developer or software nerd. Today we have GitHub feeds, Hacker News (see the previous newsletter issue), and RSS feeds in general to keep us as current as we like.
And, now we also have Freshermeat, an open source software directory and release tracker that we can each custom deploy to keep track of what's happening with our favorite projects. With it, one can:
track software releases, vulnerabilities (CVE) and news;
subscribe to releases of a project or an organization via an ATOM feed; and,
use the JSON-based API manage projects, releases, CVEs, etc. (all documented with Swagger/OpenAPI);
You (and, I) now have even fewer excuses for not keeping current. (Yay?)
The project itself was created by Cédric Bonhomme and he maintains a security-focused tracker using his codebase.
FIN
As hinted in a previous newsletter, there are some personal changes afoot which may make the coming weeks a bit hectic. Rest assured, faithful reader, that you will still see five weekly issues, but some may double up or be moved to weekends if the expected time-crunches do, indeed manifest.
If you choose to interact in the comments, remember that the only rule is to be kind. ☮