Promoting the use of R in the NHS

Blog Article

This post was originally published on this site

(This article was first published on R on YIHAN WU, and kindly contributed to R-bloggers)

baRcodeR 0.1.2 is released on CRAN today!

Download and install by

Example linear barcode

Example linear barcode

The major feature of this release is the ability to print linear (a.k.a normal) barcodes through specifying type = "linear" in create_PDF() rather than type = "matrix" which prints the usual QR code.

The github repository is at yihanwu/baRcodeR.

Minor notes on the implementation of these linear barcodes

The linear barcodes are based on the code 128B specification (Wikipedia). All ASCII characters are allowed, and non-ASCII characters are replaced by a dash. To replace characters such as é with ASCII equivalent rather than have them be replaced, use the stringi package and functions such as stringi::stri_enc_toascii.

The barcode itself is drawn using the image function, a one-D version of the heatmap function in R using the binary string for the barcode. All graphics are produced with grid if anyone wishes to move the text to the bottom of the label rather than the top.

Also, there is no error correction included in linear barcodes and barcodes which are too small will have indistinguishable bars to barcode scanners depending on their capabilities.

To leave a comment for the author, please follow the link and comment on their blog: R on YIHAN WU. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more…

Comments are closed.