Prompted by a post on Mastodon, I wanted to explore how to evaluate an R string as code. This is generally a pretty common pattern that I have myself encountered in the past and had to work through a solution for—many times. The Problem How can I programatically create and execute valid R code? A solution In this case, the problem space is quite simple: given a package name and a dataset name extract the dataset as an object You can typically extract datasets from a package’s namespace. T...