How would you write a custom function in R? Give an example

This is the syntax to write a custom function In R:

=function(x){

}

Let’s look at an example to create a custom function in R →

fun1<-function(x){
ifelse(x>5,100,0)
}
v<-c(1,2,3,4,5,6,7,8,9,10)
fun1(v)->v