Skip to content

Instantly share code, notes, and snippets.

@billspat
Last active May 13, 2021 14:27
Show Gist options
  • Save billspat/802a77eb0956252fa6f4f10fa2dfa630 to your computer and use it in GitHub Desktop.
Save billspat/802a77eb0956252fa6f4f10fa2dfa630 to your computer and use it in GitHub Desktop.
NSF badge maker!
# Make NSF award badges for your github readme or Markdown-based website!
nsf_badges <- function(award_id) {
nsf_button_template="[![NSF-{award_id}](https://img.shields.io/badge/NSF-{award_id}-blue.svg)](https://nsf.gov/awardsearch/showAward?AWD_ID={award_id})]"
badges<- stringr::str_glue(nsf_button_template)
return(paste(badges, collapse = ' ') )
}
# # example
# # if I have two NSF awards 1234567 and 4567890
# source("nsfbadger.R")
# nsf_badges(list(1234567,4567890))
# [1] "[![NSF-1234567](https://img.shields.io/badge/NSF-1234567-blue.svg)](https://nsf.gov/awardsearch/showAward?AWD_ID=1234567)] [![NSF-4567890](https://img.shields.io/badge/NSF-4567890-blue.svg)](https://nsf.gov/awardsearch/showAward?AWD_ID=4567890)]"
# copy and paste into your markdown file e.g. readme.md
# note: no error checking
# you can put anything for the award number and it will work
# based on the awesome https://shields.io/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment