The goal of {badgr} is to use R to generate URLs for metadata badges that you can use in your repository’s README file or elsewhere.

I’m not affiliated with the excellent You can back or donate to them. Find out more from their website, Twitter, Discord or go to the source code.


You can install {badgr} from GitHub with:


The package seems to do what it’s supposed to, but there are no guarantees. File an issue if you find any problems.


  1. Simple: bare bones functionality
  2. More complex: introducing a logo and changing the style
  3. Custom logo: adding your own logo

1. Simple

This is a basic example that shows you how to generate the simplest possible badge.


badge <- get_badge(
  "Left bit", "Right bit", "blue",
  to_clipboard = FALSE,     # don't copy to clipboard
  browser_preview = FALSE   # don't send to browser

The output looks like this:

#> [1] "![](]"

Which when rendered, looks like this:

2. More complex

Let’s use a few more arguments. For example, we can include a pre-prepared logo from and provide a link that will be added to the Markdown, so clicking the badge will take you to that site.

badge2 <- get_badge(
  label = "Left bit",
  message = "Right bit",
  color = "red",
  style = "for-the-badge",         # default was 'flat'
  label_color = "blue",            # colour for the left side
  md_link = "",  # include a link in the Markdown
  logo_simple = "RStudio",         # a logo
  logo_color = "white",            # a color for that logo
  logo_width = 20,                 # pad width around logo 
  browser_preview = FALSE,
  to_clipboard = FALSE

#> [1] "[![](]("

Which looks like this:

Clicking it will take you to the link specified by the md_link argument.

Similar projects

Somehow I missed the existence of the {badger} package by Guangchuang Yu, which is on CRAN. It contains functions for several pre-baked badge types, plus badge_custom().

I think the major difference is that {badgr} has a little more flexibility than {badger} for custom badge arguments and {badgr} also allows for custom icons to be added.

Code of Conduct

Please note that the {badgr} project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.