-
Notifications
You must be signed in to change notification settings - Fork 7
/
README.Rmd
89 lines (62 loc) · 2.04 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
output: rmarkdown::github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r init, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
`qrencoder` : Make QR codes in R
There is another package on CRAN -- `qrcode` -- that is not C-backed.
Quick Response codes (QR codes) are a type of matrix bar code and can be
used to authenticate transactions, provide access to multi-factor authentication
services and enable general data transfer in an image. QR codes use four standardized
encoding modes (numeric, alphanumeric, byte/binary, and kanji) to efficiently store
data. Matrix barcode generation is performed efficiently in C via the included
[libqrencode](https://github.com/fukuchi/libqrencode) library created by Kentaro Fukuchi.
The following functions are implemented:
- `qrencode`: Return a QR encoded string as a matrix
- `qrencode_df`: Return a QR encoded string as an x, y, z data.frame
- `qrencode_png`: Return a QR encoded string as a base 64 encoded inline png
- `qrencode_raster`: Return a QR encoded string as a raster object
- `qrencode_svg`: Return a QR encoded string as an svg string
### Installation
```{r show, eval=FALSE}
devtools::install_github("hrbrmstr/qrencoder")
```
```{r setup, echo=FALSE, message=FALSE, warning=FALSE, error=FALSE}
options(width=120)
```
### Usage
```{r qr}
library(qrencoder)
# current verison
packageVersion("qrencoder")
url <- "http://rud.is/b"
head(qrencode(url))
head(qrencode_df(url))
qrencode_png(url)
qrencode_raster(url)
par(mar=c(0,0,0,0))
image(qrencode_raster("http://rud.is/b"),
asp=1, col=c("white", "black"), axes=FALSE,
xlab="", ylab="")
```
### SVG
```{r qrsvg}
cat(qrencode_svg(url))
```
![](https://rud.is/dl/qr.svg)
### Test Results
```{r, test}
library(qrencoder)
library(testthat)
date()
test_dir("tests/")
```
### Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
By participating in this project you agree to abide by its terms.