R/haikunator.R

Defines functions haikunate

Documented in haikunate

#' @title Generate Heroku-like Memorable Random Names
#' @description Generate Heroku-like memorable random names to use in your
#' projects, apps or anywhere else.
#' @param token_length Token Length
#' @param delimiter Delimiter
#' @param seed_value Seed Value
#' @examples
#' haikunate(5)
#' haikunate(3,'.',123)
#' @export

haikunate <- function(token_length = 4, delimiter = '-', seed_value = NA){

        if (!is.na(seed_value)) set.seed(seed_value)

        if (token_length > 0) {

                paste(sample(default_adjectives,1),
                      sample(default_adjectives,1),
                      paste(sample( 1:9, token_length, replace=TRUE ), collapse="" ),
                      sep = delimiter)
        }

        else {
                paste(sample(default_adjectives,1),
                      sample(default_adjectives,1),
                      # paste(sample( 1:9, token_length, replace=TRUE ), collapse="" ),
                      sep = delimiter)
        }
}

default_adjectives <- c(
        'aged', 'ancient', 'autumn', 'billowing', 'bitter', 'black', 'blue', 'bold',
        'broad', 'broken', 'calm', 'cold', 'cool', 'crimson', 'curly', 'damp',
        'dark', 'dawn', 'delicate', 'divine', 'dry', 'empty', 'falling', 'fancy',
        'flat', 'floral', 'fragrant', 'frosty', 'gentle', 'green', 'hidden', 'holy',
        'icy', 'jolly', 'late', 'lingering', 'little', 'lively', 'long', 'lucky',
        'misty', 'morning', 'muddy', 'mute', 'nameless', 'noisy', 'odd', 'old',
        'orange', 'patient', 'plain', 'polished', 'proud', 'purple', 'quiet', 'rapid',
        'raspy', 'red', 'restless', 'rough', 'round', 'royal', 'shiny', 'shrill',
        'shy', 'silent', 'small', 'snowy', 'soft', 'solitary', 'sparkling', 'spring',
        'square', 'steep', 'still', 'summer', 'super', 'sweet', 'throbbing', 'tight',
        'tiny', 'twilight', 'wandering', 'weathered', 'white', 'wild', 'winter', 'wispy',
        'withered', 'yellow', 'young'
)

default_nouns <- c(
        'art', 'band', 'bar', 'base', 'bird', 'block', 'boat', 'bonus',
        'bread', 'breeze', 'brook', 'bush', 'butterfly', 'cake', 'cell', 'cherry',
        'cloud', 'credit', 'darkness', 'dawn', 'dew', 'disk', 'dream', 'dust',
        'feather', 'field', 'fire', 'firefly', 'flower', 'fog', 'forest', 'frog',
        'frost', 'glade', 'glitter', 'grass', 'hall', 'hat', 'haze', 'heart',
        'hill', 'king', 'lab', 'lake', 'leaf', 'limit', 'math', 'meadow',
        'mode', 'moon', 'morning', 'mountain', 'mouse', 'mud', 'night', 'paper',
        'pine', 'poetry', 'pond', 'queen', 'rain', 'recipe', 'resonance', 'rice',
        'river', 'salad', 'scene', 'sea', 'shadow', 'shape', 'silence', 'sky',
        'smoke', 'snow', 'snowflake', 'sound', 'star', 'sun', 'sun', 'sunset',
        'surf', 'term', 'thunder', 'tooth', 'tree', 'truth', 'union', 'unit',
        'violet', 'voice', 'water', 'waterfall', 'wave', 'wildflower', 'wind', 'wood'
)
amrrs/haikunator documentation built on May 16, 2019, 6:56 p.m.