Writing Functions in R
Posted on September 26, 2022 by R-post on Cosima Meyer in R bloggers | 0 Comments
[This article was first published on R-post on Cosima Meyer , 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.
Share Tweet
The beauty of R is its versatility and of course the community ???? you can use R for literally anything (I use blogdown to set up and maintain my website, xaringan to create slide decks, Shiny to build web applications, ….). All these great tools build upon one “little” (or not so little) thing: functions!
???? What are functions?
A function is an inherent code block that performs a specific task, such as calculating a sum. And that’s exactly what we are doing now ????
???????????? How to write them?
In R, functions can be as simple as this:
name_of_the_function