Site icon R-bloggers

Two New R Packages – qrencoder & passwordrandom

[This article was first published on rud.is » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Believe it or not, there are two [1] [2] questions on @StackOverflowR about how to make QR codes in R. I personally think QR codes are kinda hokey, but who am I to argue with pressing needs of the #rstats community? I found libqrencode and it’s highly brew-able and apt-able (probably yum-able, too, if you lean that way), so it was super-easy to crank out an Rcpp-based package for it.

There are a few functions in the package, but the following would be my guess as to how most folks would use it (well, two folks, anyway):

library(qrencoder)
library(raster)
 
par(mar=c(0,0,0,0))
image(qrencode_raster("http://rud.is/b"), 
      asp=1, col=c("white", "black"), axes=FALSE, 
      xlab="", ylab="")

Since @quominus threw down yet-another gauntlet (in our own “battle of the hoRnbuRg”) after my qrencoder announcement:

@hrbrmstr my latest package will be done in 20 minutes. FORE.

— Oliver Keyes (@quominus) August 2, 2015

I had no choice but to also crank out another package that interfaces with the PasswordRandom API. There’s at least some fairly obvious real utility to this one:

library(passwordrandom)
 
# current verison
packageVersion("passwordrandom")
#> [1] '0.0.0.9000'
 
random_chars()
#>  [1] "m" "M" "Z" "p" "G" "B" "E" "m" "B" "v"
 
random_doubles()
#>  [1] 82.6272 89.6146  1.2591 77.9003 62.5740 68.8216 61.9789 37.9001 20.6352  4.6343
 
random_guids()
#>  [1] "fdf5d58e-ebe9-4db3-b429-303e8a5e1fdf" "20ad94f9-a232-4fa8-91c6-ba21e9925b96"
#>  [3] "d44c1c4b-0117-43c3-b77c-89bc33caf59f" "500ce633-1197-4c92-aff4-1eac94fd2d8d"
#>  [5] "13b1a1a0-f7fa-40b6-a9da-9e445ac26d2b" "06362286-8d5b-4dfc-9283-df564291120d"
#>  [7] "36dbb258-ede0-4a8a-b416-5609f11c8be1" "9b27dcca-26d7-4467-9a54-3862ccbd06cf"
#>  [9] "4f53fe11-d4f0-4c01-a2fc-97e35983d567" "b1f0df88-e790-4d48-8683-ebe68db9f0ca"
 
random_ints()
#>  [1] 82 17 97 20 87 91 57 42 22 62
 
random_passwords()
#>  [1] "RoeXO2{75bh"  "RiuFE6'10hj"  "TauTY1)92pj"  "XooHO8%87rv"  "MooJA1^40np"  "KyaDU3\35tr" "KiaQY0>91nr" 
#>  [8] "XoeGO1%68nt"  "KeoFI0>33cc"  "VeaDI2$51jc"

If you’re so inclined, kick the tyres of either/both and drop a note here or issue/feature request on either repo.

To leave a comment for the author, please follow the link and comment on their blog: rud.is » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.