Lesser known apply() functions in R

Cpak
3 min readJul 19, 2020

Introduction

If you’ve used R for any length of time, you’ve learned that for loops are not your friend. Rather, you probably quickly learned to useapply functions instead: apply(), sapply() , lapply(). In this article, I’ll discuss some of the lesser known R apply functions you might not know about.

Data

We’ll use the iris dataset in a lot of examples. Here’s a reminder of what it looks like

    Sepal.Length Sepal.Width Petal.Length Petal.Width    Species
1 5.1…

--

--