Strength of a Lennon song exposed with R function glue::glue

[This article was first published on Guillaume Pressiat, 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.

love_verse <- function(w1, w2, w3){
  glue::glue(
  "Love is {b}, {b} is love
   Love is {y}, {y} love
   Love is {u} to be loved", 
  b = w1, y = w2, u = w3)
}

As a return, parameters sometimes gives echoes of poetry.

love_verse('real', 'feeling', 'wanting')
Love is real, real is love
Love is feeling, feeling love
Love is wanting to be loved
love_verse('touch', 'reaching', 'asking')
Love is touch, touch is love
Love is reaching, reaching love
Love is asking to be loved
## refrain
Love is you
You and me
Love is knowing
We can be
love_verse('free', 'living', 'needing')
Love is free, free is love
Love is living, living love
Love is needing to be loved

https://www.youtube.com/watch?v=7er_xx7Wmg8





list(list(w1 = 'real',  w2 = 'feeling',  w3 = 'wanting'),
     list(w1 = 'touch', w2 = 'reaching', w3 = 'asking' ),
     list(w1 = 'free',  w2 = 'living',   w3 = 'needing')) %>% 
  purrr::map(function(x)do.call(love_verse, x))
[[1]]
Love is real, real is love
Love is feeling, feeling love
Love is wanting to be loved

[[2]]
Love is touch, touch is love
Love is reaching, reaching love
Love is asking to be loved

[[3]]
Love is free, free is love
Love is living, living love
Love is needing to be loved

We could also read title of this article as “strength of an R function exposed with a Lennon song”…

To leave a comment for the author, please follow the link and comment on their blog: Guillaume Pressiat.

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.

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)