How to vectorize a function

Hello,

I have been using R for 6 years, but I still do not understand what it means to vectorize a function. I have read a lot about it, yet I feel that I don't know how to implement it. I know that it makes the code run faster, which is why I'm interested to learn.

Can you explain what vectorize a function means? Can you provide a clear examples?

P.S. can someone add vectorize as a tag?

Thank you!

And maybe you'll find the example provided in this topic How to Vectorize a function in R RStudio helpful as well.

You might find chapters 3 (Failing to Vectorize) and 4 (Over-vectorizing) of the R Inferno helpful.