baRcodeR generates labels for more repeatable workflows with biological samples


You can install the released version of baRcodeR from CRAN with:

And the development version from GitHub with:

NOTE: Restarting RStudio is necessary for the addin for baRcodeR to appear.

Quick Start

Text identifiers can be created in a sequential or hierarchical pattern.

example_labels <- uniqID_maker(user = FALSE, string = "Example", level = 1:80)

Then the text identifiers can be printed out with a laser printer on sticker sheets.

pdf_file_name <- tempfile()
create_PDF(Labels = example_labels, name = pdf_file_name)

Th particular layout above defaults to ULINE 1.75" * 0.5" labels but other layouts can be specified through parameters in the custom_create_PDF function.


baRcodeR is a R package for generating unique identifier strings and printable 2D (QR) barcodes, with the aim of improving repeatability of labelling, tracking and curating data from biological samples. Specifically, users can:

  • generate simple ID codes (Ex001, Ex002, Ex003 …),
  • generate hierarchical (i.e. nested) ID codes (A01-B01, A01-B02, A02-B01, A02-B02, A03-B01 …),
  • generate printable PDF files of paired ID codes and QR barcodes with default spacing for ULINE 1.75" * 0.5" WEATHER RESISTANT LABEL for laser printer; item # S-19297 (
  • customize the PDF layout for any type of printable format (e.g, vinyl stickers, waterproof paper)
  • generate reproducible code for archival purposes (e.g. in publications or online repositories)
  • create CSV files to link unique IDs and sampling hierarchy with downstream data collection workflows. For example, the PyTrackDat pipeline can be used to set up a web-based data collection platform:

Creating unique, scannable barcodes generally involves two steps:

  1. Generate unique ID codes with uniqID_maker() or uniqID_hier_maker()
  2. Create a PDF file containing unique ID codes coupled with 2D barcode using create_PDF()

If you already have ID codes saved in a CSV file, the csv can be read into a data.frame() in R. The label column, if it exists will be used as input to generate barcodes. Otherwise, the first column in the data frame will be used.

NOTE: When printing from pdf, ensure that ‘anti-aliasing’ or ‘smoothing’ options are turned OFF, and that you are not using ‘fit to page’ or similar options that will re-scale the output.

Flowchart of major functions

Cheat Sheet

A 2-page, quick-reference guide is available via Figshare

Usage with RStudio addin

Please load the vignette “Use Addin”.


Usage from the console

Please load the vignette “Using-baRcodeR” for console use.


See also:

  • zintris an R interface to the C zint library. Use zintr if you want to create single barcode images. zintr does not include functions for (i) automating the creation of biologically-relevant, unique ID codes or (ii) customizable layouts for printing multiple barcodes.

  • zint is a C library that generates a variety of different barcodes. Just like zintr, zint produces single barcode images.