Site icon R-bloggers

Little useless-useful R functions – Reverse Hello World

[This article was first published on R – TomazTsql, 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.

You know the feeling after long vacation and finally sitting in front of your favourite UI and even forgot how to write simplest “hello world” or “foo bar” function? Well, we got you covered! The reverse Hello world function is for all the people returning to the office after rather long vacation.

Create the function:

# reverse Hello World
hello_world <- function(print){
  if (print == "print"){
    print("Hello World")
  } else {
    cat("\rWell ...")
  }
}

And be confused for a split second, when you want to use this function correctly

Welcome back!

As always, the complete code is available on GitHub in  Useless_R_function repository. The sample file in this repository is here (filename: reverse_hello_world.R). Check the repository for future updates.

Happy R-coding and stay healthy!

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

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.
Exit mobile version