sentence: Sentence style identifiers

Description Usage Arguments Author(s) Examples

View source: R/sentence.R

Description

Create a sentence style identifier. This uses the approach described by Asana on their blog https://blog.asana.com/2011/09/6-sad-squid-snuggle-softly/. This approach encodes 32 bits of information (so 2^32 ~= 4 billion possibilities) and in theory can be remapped to an integer if you really wanted to.

Usage

1
2
3
4
5
6
7
sentence(
  n = 1,
  style = "snake",
  past = FALSE,
  global = TRUE,
  use_openssl = NULL
)

Arguments

n

number of ids to return. If NULL, it instead returns the generating function

style

Style to join words with. Can be one of "Pascal", "camel", "snake", "kebab", "dot", "title", "sentence", "lower", "upper", "constant" or "spongemock"

past

Use the past tense for verbs (e.g., slurped or jogged rather than slurping or jogging)

global

Use global random number generator that responds to set.seed (see random_id for details, but note that the default here is different).

use_openssl

Use openssl for random number generation when using a non-global generator (see random_id for details)

Author(s)

Rich FitzJohn

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Generate an identifier
ids::sentence()

# Generate a bunch
ids::sentence(10)

# As with adjective_animal, use "style" to control punctuation
ids::sentence(style = "Camel")
ids::sentence(style = "dot")
ids::sentence(style = "Title")

# Change the tense of the verb:
set.seed(1)
ids::sentence()
set.seed(1)
ids::sentence(past = TRUE)

# Pass n = NULL to bind arguments to a function
id <- ids::sentence(NULL, past = TRUE, style = "dot")
id()
id(10)

richfitz/ids documentation built on Dec. 13, 2021, 7:07 a.m.