Skip to contents

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

Usage

qr_code(x, ecl = c("L", "M", "Q", "H"))

Arguments

x

the input string

ecl

the required error correction level. Available options are "L" (7%), "M" (15%), "Q" (25%) and "H" (30%). Defaults to "L".

Value

The QR code as a logical matrix with "qr_code" class.

Author

Thierry Onkelinx

Examples

qr_code("https://www.r-project.org")
#>                 
#>  ▗▄▄▄▗▗▗▖▗▗▄▄▄  
#>  ▐▗▄▐▗█▀▛▞▐▗▄▐  
#>  ▐▐█▐▐▀▟▜▄▐▐█▐  
#>  ▐▄▄▟▗▐▚▜▐▐▄▄▟  
#>  ▗▄▖▗▗▐▟▗▘▖▗▄▗  
#>   ▀▌▗▟▟▟▄▝▘▌ ▘  
#>  ▐▜▘▙▙█▗█▟█▄▜▄  
#>   ▞▖▚▘▄▛▄▀▞▜▗▞  
#>  ▝▐█▚█▜▘▄█▙█▄▟  
#>  ▗▄▄▄▝█ ▄▐▗▐▐▟  
#>  ▐▗▄▐ ▄▝▐▐▄▟▖▗  
#>  ▐▐█▐▐▀▌▌▀▟▐▜▛  
#>  ▐▄▄▟▐ ▘█▘▀▟▟▄  
#>                 
#>                 
#> 
#> use plot() for a better quality image
qr <- qr_code("https://cran.r-project.org/package=qrcode", ecl = "M")
qr
#>                   
#>  ▗▄▄▄▗▗ ▗▗▄▖▗▄▄▄  
#>  ▐▗▄▐▝▜▞▛▐▝▟▐▗▄▐  
#>  ▐▐█▐▝▄▘▜█▘▞▐▐█▐  
#>  ▐▄▄▟▗▐▐▗▗▜▜▐▄▄▟  
#>  ▗▗▖▄▞▞▜▗▞█▛▗ ▖▄  
#>  ▗█▟▄▞▐█▌▗ ▀█▟▗▞  
#>  ▝▟▀▗ █▙█▖▖▀ ▀▄▝  
#>    ▟▙▛▜▝▟▀▙▌▜▖▐█  
#>  ▐▄▌▙█▞▚▖▝ ▙▀▟▖▌  
#>  ▗▐▜▄▜▝▙▚▙▌▐▗▘▜▘  
#>   ▞▙▙▙▌ ▖▗█▚▙▙▟   
#>  ▗▄▄▄▐▗▐▌▐▖▟▗▐▛▛  
#>  ▐▗▄▐▝▜▄▗▀▖▐▄▟▚█  
#>  ▐▐█▐▐▚▛▜▀▘▖▌▞▚▐  
#>  ▐▄▄▟▗▜▀▖ ▗█▘▌▘▌  
#>                   
#>                   
#> 
#> use plot() for a better quality image
plot(qr)

# the qr_code object is a logical matrix
str(qr)
#>  'qr_code' logi [1:35, 1:35] FALSE FALSE FALSE FALSE FALSE FALSE ...
#>  - attr(*, "string")= chr "https://cran.r-project.org/package=qrcode"
#>  - attr(*, "ecl")= chr "M"
qr[1:10, 1:10]
#>        [,1]  [,2]  [,3]  [,4]  [,5]  [,6]  [,7]  [,8]  [,9] [,10]
#>  [1,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [2,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [3,] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
#>  [4,] FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE
#>  [5,] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE
#>  [6,] FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE FALSE  TRUE
#>  [7,] FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE FALSE  TRUE
#>  [8,] FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE FALSE  TRUE
#>  [9,] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE  TRUE
#> [10,] FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE