make_qrcode: Make QR codes

View source: R/all_new_functions.R

make_qrcodeR Documentation

Make QR codes

Description

A helper function for QR code generation using the 'qrencoder' library for faster QR code generation. It converts the generated QR code into a raster grob image that can be plotted using the ‘grid.draw()' function in the ’grid' package.

Usage

make_qrcode(my_id, ec_level = 3)

Arguments

my_id

Unique ID string to be encoded to QR code.

ec_level

The error correction level ('0' - '3', lowest to highest).

Value

A QR code as a raster grob image object that can be plotted with the 'grid.draw()' function in the 'grid' package.

Examples


library(qrlabelr)
qr <- make_qrcode("KUMASI2023_PYT_101_1_1", ec_level = 1)

# Plot QR code using the grid package
grid::pushViewport(grid::viewport(x = grid::unit(0.5, "npc"),
                                  y = grid::unit(0.5, "npc"),
                                  width = grid::unit(1, "in"),
                                  height = grid::unit(1, "in")))
grid::grid.draw(qr)
# clean up any open graphical device
# grDevices::graphics.off()


qrlabelr documentation built on May 29, 2024, 10:16 a.m.