Weird Al Yankovise() a 2 Chainz Lyric

October 10, 2017
By

(This article was first published on rstats – MikeJackTzen, and kindly contributed to R-bloggers)

I have a character string snipped from a lyric by Daniel Son the Necklace Don.

Let’s get all Weird Al Yankovic with it.

I’ll revise some words with the datzen::yankovise() function. You can swap out words using a dictionary of name-value pairs.

paste0(snip <<- "Suede sun roof, hanging out the big top We leave the dealership, head to the rim shop", " - @2chainz aka the Hair Weave Killer") 
#> [1] "Suede sun roof, hanging out the big top We leave the dealership, head to the rim shop - @2chainz aka the Hair Weave Killer"

Above, we have a bar from 2 Chainz aka the Hair Weave Killer.

Below, we have the yankovised bar from @2Chainz_PhD aka the CPU Core Killer aka ProbaBittyBoi aka Daniel Son the Data Don aka El Efron Jr.

# user supplied dictionary
dict_outin = c(
datzen::dictate_outin('dealership','SERVER ROOM'),
datzen::dictate_outin('big','LAP'),
datzen::dictate_outin('rim','RAM')
)

yankovise(snip,suffix="- @2Chainz_PhD",dict_outin = dict_outin)
#> [1] "suede sun roof hanging out da LAP top we leave da SERVER ROOM head 2 da RAM shop - @2Chainz_PhD"

You might ask, isn’t this just a wrapper to gsub() or stringr::str_replace_all() with some added flavor? I might say, yes, yes it is… only with a narrower scope and whose output is streamlined as tweet-ready text.

To leave a comment for the author, please follow the link and comment on their blog: rstats – MikeJackTzen.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)