MyNixOS website logo
Description

Generate QRcodes with R.

Create static QR codes in R. The content of the QR code is exactly what the user defines. We don't add a redirect URL, making it impossible for us to track the usage of the QR code. This allows to generate fast, free to use and privacy friendly QR codes.

CRANstatus Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. Lifecycle:stable GitHub Codecov GitHub code size inbytes GitHub reposize DOI

QRcode Generator for R A hexagon with the word qrcode and a qrcode linking to the DOI

A QR code is a two-dimensional barcode developed by the Denso Wave company.

The current implementation handles three modes: numeric, alphanumeric and byte. Kanji is currently not supported. Please contact the maintainer if you need it.

  • Numeric: only digits from 0 to 9
  • Alphanumeric: all numeric characters, upper case LETTERS, and the characters " " (space), "$", "%", "*", "+", "-", ".", "/" and ":"
  • Byte: All characters from the Latin 1 (ISO 8859-1) character set.

Main functions

The main qr_code() function returns an object of the qr_code class. This is a logical matrix with specific methods for printing and plotting. The print version uses UTF-8 drawing symbols and the result depend on the font used. For a better quality QR code it best to use plot() or generate_svg().

library(qrcode)
code <- qr_code("QR CODE")
print(code)
##               
##  ▗▄▄▄  ▗▗▄▄▄  
##  ▐▗▄▐ ▐▟▐▗▄▐  
##  ▐▐█▐▐▞▐▐▐█▐  
##  ▐▄▄▟▗▚▚▐▄▄▟  
##  ▗▖ ▄▖ ▖ ▗▖   
##  ▝▄▜▄▌▘▜▚▛▚█  
##  ▐▜█▚▀▐██▙▙▞  
##  ▗▄▄▄▐▄▞▖▗▟▄  
##  ▐▗▄▐▝▖▖▞▗▟▘  
##  ▐▐█▐ ▞█▛▄▐▄  
##  ▐▄▄▟▐▘▜▀▐▜▝  
##               
##               
## 
## use plot() for a better quality image
plot(code)
A QR code displaying the value 'QR CODE'
generate_svg(code, filename = "man/figures/qr.svg")
A QR code displaying the value ‘QR CODE’

Installation

The qrcode package is available from CRAN, R universe and GitHub.

# install from CRAN
install.packages("qrcode")
# install from R universe
install.packages("qrcode", repos = "https://thierryo.r-universe.dev")
# install from GitHub use the remotes package
remotes::install_github("ThierryO/qrcode")

Legacy code

The legacy function qrcode_gen() had several known bugs. Because of these bugs, we re-implemented the code from scratch in version 0.1.4. We created new functions. The old functions are defunct since version 0.2.0. We removed them in version 0.2.2.

Metadata

Version

0.2.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows