Getting a word-cloud image with R

Since I made a word-cloud image for a collaborator’s project, it caught people’s attention. It seems to be a good way to display science research in a vivid way. I would like to document this effort for future reference.

I need to give the credit to Rshiny-Application, which gets me interested producing the word cloud in R. 
There are a few libraries are quite popular for making a word-cloud: library(tm), library(SnowballC), library(wordcloud), library(memoise).


I have found some websites that helped me to learn about word-cloud. I’d like to document them for others and give the authors credit for their works.

The one from data science does not work for me. It generates error like "Error in simple_triplet_matrix(i, j, v, nrow = length(terms), ncol = length(corpus),  : 
  'i, j' invalid"
Here is another one
Another package is called wordcloud2 with a few examples