lorem ipsum methods
Super class
charlatan::BaseProvider
-> LoremProvider
Methods
Inherited methods
charlatan::BaseProvider$bothify()
charlatan::BaseProvider$check_locale()
charlatan::BaseProvider$lexify()
charlatan::BaseProvider$numerify()
charlatan::BaseProvider$random_digit()
charlatan::BaseProvider$random_digit_not_zero()
charlatan::BaseProvider$random_digit_not_zero_or_empty()
charlatan::BaseProvider$random_digit_or_empty()
charlatan::BaseProvider$random_element()
charlatan::BaseProvider$random_element_prob()
charlatan::BaseProvider$random_int()
charlatan::BaseProvider$random_letter()
charlatan::BaseProvider$randomize_nb_elements()
Method new()
Create a new LoremProvider
object
Usage
LoremProvider$new(
locale = NULL,
sentence_punctuation = ".",
word_connector = " "
)
Method words()
Generate a character vector of random words
Method sentence()
Generate a random sentence
Arguments
nb_words
(integer) around how many words the sentence should contain
variable_nb_words
set to
FALSE
if you want exactlynb
words returned, otherwise the result may include a number of words ofnb
+/-40% (with a minimum of 1)ext_words
a character vector of words you would like to have instead of 'Lorem ipsum'
Method sentences()
Generate a character vector of random sentences
Method paragraph()
Generate a single paragraph
Arguments
nb_sentences
(integer) around how many sentences the paragraph should contain
variable_nb_sentences
set to
FALSE
if you want exactlynb
sentences returned, otherwise the result may include a number of sentences ofnb
+/-40% (with a minimum of 1)ext_words
a character vector of words you would like to have instead of 'Lorem ipsum'
Method paragraphs()
Generate many paragraphs
Method text()
Generate a random text string. Depending on the
max_nb_chars
, returns a string made of words, sentences, or
paragraphs.
Examples
(x <- LoremProvider$new())
#> <LoremProvider>
#> Inherits from: <BaseProvider>
#> Public:
#> allowed_locales: function ()
#> bothify: function (text = "## ??")
#> check_locale: function (x)
#> clone: function (deep = FALSE)
#> initialize: function (locale = NULL, sentence_punctuation = ".", word_connector = " ")
#> lexify: function (text = "????")
#> locale: en_US
#> numerify: function (text = "###")
#> paragraph: function (nb_sentences = 3, variable_nb_sentences = TRUE, ext_words = NULL)
#> paragraphs: function (nb = 3, ext_words = NULL)
#> random_digit: function ()
#> random_digit_not_zero: function ()
#> random_digit_not_zero_or_empty: function ()
#> random_digit_or_empty: function ()
#> random_element: function (x)
#> random_element_prob: function (x)
#> random_int: function (min = 0, max = 9999, size = 1)
#> random_letter: function ()
#> randomize_nb_elements: function (number = 10, le = FALSE, ge = FALSE, min = NULL, max = NULL)
#> sentence: function (nb_words = 6, variable_nb_words = TRUE, ext_words = NULL)
#> sentences: function (nb = 3, ext_words = NULL)
#> text: function (max_nb_chars = 200, ext_words = NULL)
#> word: function (ext_words = NULL)
#> words: function (nb = 3, ext_words = NULL)
#> Private:
#> cap_first: function (x)
#> drop_last: function (x)
#> locales: en_US ar_AA el_GR he_IL ja_JP la ru_RU zh_CN zh_TW
#> parse_eval_safe: function (name)
#> sentence_punctuation: .
#> word_connector:
#> word_list: a ability able about above accept according account acro ...
x$locale
#> [1] "en_US"
x$word()
#> [1] "child"
x$words(3)
#> [1] "technology" "blood" "sound"
x$words(6)
#> [1] "program" "check" "data" "something" "capital" "for"
x$sentence()
#> [1] "With course week without five none fill."
x$sentences(3)
#> [1] "Impact alone effect ability long." "Seat alone technology husband."
#> [3] "Religious clear language tend."
x$sentences(6)
#> [1] "Age when remember cover south public."
#> [2] "Want set practice."
#> [3] "Daughter show between method once."
#> [4] "Follow poor consumer everything candidate real be."
#> [5] "Have star popular new benefit clearly whose audience."
#> [6] "Choose very series walk charge opportunity prevent."
x$paragraph()
#> [1] "Visit wonder table tax only wrong southern. Sport cut design issue less."
x$paragraphs(3)
#> [1] "Score relationship third song stay point. By star similar water lay plant song. Fish executive remember. Perform so tell hope know thank."
#> [2] "Fill production author. Sense value collection finally forward high. Enjoy significant play inside."
#> [3] "Different subject better claim health story. Five close section eight take arrive simple. Bad pretty low ball indeed."
x$paragraphs(6)
#> [1] "Top attorney thing could bed billion. Official address able this manager. Mean believe decision to nation. Pressure area watch option future use."
#> [2] "Newspaper prevent network religious. None land record finish. Mind off ten middle interesting."
#> [3] "Red too wife special. Wide executive lead. Parent teach size sometimes idea."
#> [4] "Line else sense those machine discover. Drive attorney his attorney look. Radio big interesting including structure about score."
#> [5] "Politics music speech she. Thing for within so bar. Color away heavy plan star yourself."
#> [6] "Again same technology probably deal."
cat(x$paragraphs(6), sep = "\n")
#> Sea often model benefit rather. Century base she though family chair stuff.
#> High eat evening measure view. Reach beautiful administration discuss gas technology.
#> Challenge couple anyone source. Firm modern next might.
#> Technology every owner bill ability. Media man hear indicate measure its firm. Interest box kind inside sign three.
#> Keep rich kind customer oil response. Such letter onto about director home across. Study food eat individual strategy Democrat present spend.
#> Actually hard woman fast. Serious first player sit. Trip current seven matter.
x$text(6)
#> [1] "Argue."
x$text(10)
#> [1] "Let."
x$text(19)
#> [1] "Hold behind lawyer."
x$text(25)
#> [1] "Pay reason day seven."
x$text(50)
#> [1] "Name business include sense."
x$text(300)
#> [1] "Citizen stuff drive film because where American determine. Research baby fast response whole research. Suggest job significant film person pattern truth. News so change modern describe."
x$text(2000)
#> [1] "Education as serve. Listen analysis effect thousand better.\nWater them month. Air allow above station region. Make much sense smile ago subject thousand. Beautiful land financial national.\nEntire deep raise firm inside story. Yet specific back drive far owner small.\nNewspaper key get child sea hard issue. Good market federal enter.\nBegin treatment civil natural away physical region. Amount mother mission institution. Drug toward actually almost art wrong.\nChange behavior network wide game. Free wait could meet scene. Picture within next raise our foreign direction put.\nAccording fact purpose no technology. Late scientist series long crime sort second bit.\nWant fill relationship town attention first. Company officer record collection season risk choose.\nTelevision future try second manager. Report improve good since into.\nSend drug watch some. Local way mention. Turn word sort sound dinner.\nDebate on environmental when more. Sometimes Mrs it general. Property move church away call newspaper.\nGet partner page despite. Involve appear television none sometimes. Low method understand boy expert address.\nSong use mean board yes mission. Across leave pick note more force remember prepare.\nEmployee heavy few tough against according model. Now wish pattern rate special. Room even drug show whose authority hair.\nBecome statement hold run. Process research why glass still price toward. Style radio national design.\nSomething east wonder. Born people woman opportunity compare.\nCulture model what major relate cost. Administration yourself letter situation with. Each evidence prove professional activity. Same model within art dinner sound assume worry.\nMillion fill picture against. Note once require outside time. Fire environmental sell bed.\nMember somebody risk compare measure in. Instead cut feel adult consumer. Sport face go campaign get five three partner.\nWhen across deal minute paper time front. Time there easy again have soon."
# set a different sentence_punctuation or word_connector
(x <- LoremProvider$new(sentence_punctuation = ";"))
#> <LoremProvider>
#> Inherits from: <BaseProvider>
#> Public:
#> allowed_locales: function ()
#> bothify: function (text = "## ??")
#> check_locale: function (x)
#> clone: function (deep = FALSE)
#> initialize: function (locale = NULL, sentence_punctuation = ".", word_connector = " ")
#> lexify: function (text = "????")
#> locale: en_US
#> numerify: function (text = "###")
#> paragraph: function (nb_sentences = 3, variable_nb_sentences = TRUE, ext_words = NULL)
#> paragraphs: function (nb = 3, ext_words = NULL)
#> random_digit: function ()
#> random_digit_not_zero: function ()
#> random_digit_not_zero_or_empty: function ()
#> random_digit_or_empty: function ()
#> random_element: function (x)
#> random_element_prob: function (x)
#> random_int: function (min = 0, max = 9999, size = 1)
#> random_letter: function ()
#> randomize_nb_elements: function (number = 10, le = FALSE, ge = FALSE, min = NULL, max = NULL)
#> sentence: function (nb_words = 6, variable_nb_words = TRUE, ext_words = NULL)
#> sentences: function (nb = 3, ext_words = NULL)
#> text: function (max_nb_chars = 200, ext_words = NULL)
#> word: function (ext_words = NULL)
#> words: function (nb = 3, ext_words = NULL)
#> Private:
#> cap_first: function (x)
#> drop_last: function (x)
#> locales: en_US ar_AA el_GR he_IL ja_JP la ru_RU zh_CN zh_TW
#> parse_eval_safe: function (name)
#> sentence_punctuation: ;
#> word_connector:
#> word_list: a ability able about above accept according account acro ...
x$paragraph(4)
#> [1] "Discuss blood performance economy international; Deal evidence near movement language husband;"
(x <- LoremProvider$new(word_connector = " --- "))
#> <LoremProvider>
#> Inherits from: <BaseProvider>
#> Public:
#> allowed_locales: function ()
#> bothify: function (text = "## ??")
#> check_locale: function (x)
#> clone: function (deep = FALSE)
#> initialize: function (locale = NULL, sentence_punctuation = ".", word_connector = " ")
#> lexify: function (text = "????")
#> locale: en_US
#> numerify: function (text = "###")
#> paragraph: function (nb_sentences = 3, variable_nb_sentences = TRUE, ext_words = NULL)
#> paragraphs: function (nb = 3, ext_words = NULL)
#> random_digit: function ()
#> random_digit_not_zero: function ()
#> random_digit_not_zero_or_empty: function ()
#> random_digit_or_empty: function ()
#> random_element: function (x)
#> random_element_prob: function (x)
#> random_int: function (min = 0, max = 9999, size = 1)
#> random_letter: function ()
#> randomize_nb_elements: function (number = 10, le = FALSE, ge = FALSE, min = NULL, max = NULL)
#> sentence: function (nb_words = 6, variable_nb_words = TRUE, ext_words = NULL)
#> sentences: function (nb = 3, ext_words = NULL)
#> text: function (max_nb_chars = 200, ext_words = NULL)
#> word: function (ext_words = NULL)
#> words: function (nb = 3, ext_words = NULL)
#> Private:
#> cap_first: function (x)
#> drop_last: function (x)
#> locales: en_US ar_AA el_GR he_IL ja_JP la ru_RU zh_CN zh_TW
#> parse_eval_safe: function (name)
#> sentence_punctuation: .
#> word_connector: ---
#> word_list: a ability able about above accept according account acro ...
x$paragraph(4)
#> [1] "Buy --- among --- fire --- dinner --- four --- city. --- Head --- beat --- culture. --- Certain --- performance --- significant --- nothing. --- Serious --- bed --- along --- foot --- improve --- family --- next --- him."
# different locales
LoremProvider$new(locale = "ar_AA")$word()
#> [1] "بنقطة"
LoremProvider$new(locale = "el_GR")$word()
#> [1] "ήδη"
LoremProvider$new(locale = "he_IL")$word()
#> [1] "זותה"
LoremProvider$new(locale = "ja_JP")$word()
#> [1] "狐"
LoremProvider$new(locale = "zh_TW")$word()
#> [1] "起來"