What are anonymous function in R?



I am currently studying about anonymous function in R.

anonymous function - function that are not named appropriately are known as anonymous function.

While reading I encounter one example. But I am not able to understand it.

evaluate <- function (func , dat){

evaluate(function(x){x+1}, 6}


hi @harry,

Anonymous functions are just functions for which you choose not to give a name.

In the above example the function has no name but is performing the operations.
This is the same as:

f <- function(x) x + 3

btw: It is always a good idea to name your functions!!
Hope this helps!!