Weird Al Yankovise() a 2 Chainz Lyric
[This article was first published on rstats – MikeJackTzen, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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 about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.