I love assigning project code names.

However, after a certain point the increase in projects decrease the amount of time I am able to commit to assigning a meaningful code name to each one. I needed something more scalable that I could quickly use and revisit later if the idea or prototype had any legs to stand on.

Why spend all that time on something if it would never see the light of day?

There is a nifty #rstats package called {codename} which I had a lot of fun using.

This can get you started but I wanted something more expressive and customizable.

In hindsight I totally should’ve named this article “shit brown autumn”…

In this quick walkthrough I will show how you can generate your own project code name by using the R statistical computing language.

Load packages

library(tidyverse)
library(rcorpora)

We will rely on the {rcorpora} library which is a “collection of small text corpora of interesting data.”

Below highlights a sample of what is available:

corpora() %>% head(30)
##  [1] "animals/birds_antarctica"      "animals/birds_north_america"  
##  [3] "animals/cats"                  "animals/collateral_adjectives"
##  [5] "animals/common"                "animals/dinosaurs"            
##  [7] "animals/dog_names"             "animals/dogs"                 
##  [9] "animals/donkeys"               "animals/horses"               
## [11] "animals/ponies"                "archetypes/artifact"          
## [13] "archetypes/character"          "archetypes/event"             
## [15] "archetypes/setting"            "architecture/passages"        
## [17] "architecture/rooms"            "art/isms"                     
## [19] "colors/crayola"                "colors/dulux"                 
## [21] "colors/google_material_colors" "colors/paints"                
## [23] "colors/palettes"               "colors/web_colors"            
## [25] "colors/xkcd"                   "corporations/cars"            
## [27] "corporations/djia"             "corporations/fortune500"      
## [29] "corporations/industries"       "corporations/nasdaq"

Create dictionary

The {rcorpora} package has over 290 datasets but we’ll use three of them for this simple guide: moods, colors, and animals.

moods <- corpora("humans/moods") %>% 
  as_tibble() %>% 
  select(mood = moods)

colors <- corpora("colors/web_colors")$colors$color %>% 
  as_tibble() %>% 
  rename(color = value)

animals <- corpora("animals/common") %>% 
  as_tibble() %>% 
  rename(animal = animals)

Define function

What we want to do next is to create a function which:

  • Accepts a numerical value on how many code names we want generated
  • Pulls out a random value from each one of our dictionaries (moods, colors, animals)
  • Merges them together and spits out the final list of code names

Let’s call our function “whimsical otter” since it was the designated code name for this article when I was first writing it:

whimsical_otter <- function(n){
  
  m <- moods %>% sample_n(n)
  c <- colors %>% sample_n(n)
  a <- animals %>% sample_n(n)
  
  df <- cbind(m, c, a) %>% 
    mutate(codename = paste(mood, color, animal),
           codename = str_to_lower(codename)) %>% 
    select(codename)
  
  return(df)
  
}

Now, let’s make sure it works by having it generate 20 project code names:

whimsical_otter(20)
##                            codename
## 1         gullible midnightblue hog
## 2           apprehensive olive boar
## 3   energized darkgoldenrod wildcat
## 4                gentle gold donkey
## 5           vengeful purple giraffe
## 6        excluded indigo  wolverine
## 7   insensitive powderblue elephant
## 8   welcoming mediumslateblue moose
## 9         protected rosybrown skunk
## 10            reassured snow jaguar
## 11      passionate goldenrod iguana
## 12            harmonious sienna ape
## 13 insignificant darkorchid cheetah
## 14         secure saddlebrown tapir
## 15   disturbed forestgreen antelope
## 16           super papayawhip dingo
## 17             bewildered beige cat
## 18           accepted cadetblue cow
## 19        silly lightsalmon opossum
## 20         guarded chocolate turtle

This looks good to me. :)