Earlier this week, I was captured by this tweet.
When you think about it, we take a lot of our software for granted. The fact that @zenrhino went out of his way to say “Hey, this library is great!” was a sign from the software gods that I needed to showcase it for the software showcase this week. Without further ado, let’s highlight the tidyverse/glue package! If you already know about glue, we encourage you to contribute to the research software encyclopedia and annotate the respository:
otherwise, keep reading!
At face value, Glue sounds a lot like Python format strings, because you can throw all kinds of expressions into strings and have them evaluated:
Glue offers interpreted string literals that are small, fast, and dependency-free. Glue does this by embedding R expressions in curly braces which are then evaluated and inserted into the argument string.
For example, here is formatting a name into a string using Glue in R:
library(glue)
name = "Dinosaur"
glue('My name is {name}.')
# My name is Dinosaur.
and here is the same thing in Python, which will work for Python 3.6 and greater:
name = "Dinosaur"
print(f"My name is {name}")
But it does a little more than that, because as the tweet noted, glue_sql
has been a lifesaver!
You can easily convert your R namespace into an sql query to submit:
glue_sql("SELECT * FROM {`tbl`} WHERE species IN ({vals*})",
vals = c("setosa", "versicolor"), .con = con)
but that’s just a tiny example, and I won’t do the library justice in this post! Check out the:
for more examples. And check out the entire thread for a lot more examples of valuable, yet under-valued software! Let us know if you’d like a package to be featured on the software showcase.
To cite package ‘glue’ in publications use:
Jim Hester (2020). glue: Interpreted String Literals. https://github.com/tidyverse/glue,
https://glue.tidyverse.org/.
The BibTeX entry for LaTeX users looks like:
@Manual{,
title = {glue: Interpreted String Literals},
author = {Jim Hester},
year = {2020},
note = {https://github.com/tidyverse/glue, https://glue.tidyverse.org/},
}
You can also post questions on the GitHub issues board.
This is just one library! Just think of the sheer number of libraries that we use on a daily basis that we might take for granted. Let’s not do that anymore - let’s decide to showcase our software, even if it’s just a small shoutout.
or read more about annotation here. You can clone the software repository to do bulk annotation, or annotation any repository in the software database, We want annotation to be fun, straight-forward, and easy, so we will be showcasing one repository to annotate per week. If you’d like to request annotation of a particular repository (or addition to the software database) please don’t hesitate to open an issue or even a pull request.
You might find these other resources useful:
For any resource, you are encouraged to give feedback and contribute!