Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Random Strings

20180604 It is sometimes very useful to be able to test out some code using some test data. A simple way to generate test strings us with stringi::stri_rand_lipsum().
stri_rand_lipsum(20)
##  [1] "Lorem ipsum dolor sit amet, himenaeos potenti, eleifend aenean pri...
##  [2] "Eleifend faucibus tortor erat in non nisl id. Purus ex inceptos ve...
##  [3] "Nascetur fusce nisl eu, in ridiculus ac, cursus facilisi ligula, e...
##  [4] "Tempus leo rutrum sagittis ornare sed est ante. Diam orci pellente...
##  [5] "A morbi velit libero accumsan ut. Erat metus ex vehicula nisi et e...
##  [6] "Ligula sem conubia sed eu dolor turpis vel, mollis. Eros, venenati...
##  [7] "Cras aliquam in sed odio, arcu scelerisque. Ac et in sed. Hac amet...
##  [8] "Tortor vestibulum sagittis vitae donec sem feugiat, non facilisis....
##  [9] "Ligula sed interdum eleifend vitae class leo et. Varius volutpat m...
## [10] "Erat viverra, at, in congue vitae in non. Nulla ante velit ut ut s...
## [11] "Mus pulvinar enim, leo pellentesque hendrerit velit nulla rutrum s...
## [12] "Ut integer praesent pellentesque, arcu urna. Sed tincidunt tortor ...
## [13] "Rutrum nisl in sapien eget, massa justo elementum nulla urna lectu...
## [14] "Dapibus sed erat suscipit tempor litora in proin suscipit lacinia ...
## [15] "Massa eros in faucibus auctor faucibus eu aptent, lobortis sem. No...
## [16] "Nec mauris amet nibh nisl aliquet. Non leo primis semper donec viv...
## [17] "Magna cras sed id est. Ligula cursus, nisi. Sollicitudin at, eu at...
## [18] "Et, imperdiet et lorem fusce nisi morbi enim. Mi et purus id purus...
## [19] "Proin amet donec accumsan adipiscing, elementum viverra mauris ad ...
## [20] "Mauris, sed. Ligula ad tellus justo vel neque nulla eu. Amet, vari...
stri_rand_lipsum(2)
## [1] "Lorem ipsum dolor sit amet, torquent scelerisque nam sed id augue e...
## [2] "Ut class feugiat amet etiam, in. A ac ipsum potenti et a duis ipsum...
sapply(stri_rand_lipsum(10), nchar, USE.NAMES=FALSE)
##  [1] 567 720 543 689 583 488 447 696 825 713
sapply(stri_rand_lipsum(10), nchar, USE.NAMES=FALSE)
##  [1] 681 420 563 814 735 465 480 810 791 612

The strings generated are of different lengths and each call generates different strings.


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.