parent
335a0cb291
commit
f0215486cc
|
@ -938,9 +938,9 @@ vs <- list(
|
||||||
vs %>% reduce(intersect)
|
vs %>% reduce(intersect)
|
||||||
```
|
```
|
||||||
|
|
||||||
The reduce function takes a "binary" function (i.e. a function with two primary inputs), and applies it repeatedly to a list until there is only a single element left.
|
`reduce()` takes a "binary" function (i.e. a function with two primary inputs), and applies it repeatedly to a list until there is only a single element left.
|
||||||
|
|
||||||
Accumulate is similar but it keeps all the interim results. You could use it to implement a cumulative sum:
|
`accumulate()` is similar but it keeps all the interim results. You could use it to implement a cumulative sum:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
x <- sample(10)
|
x <- sample(10)
|
||||||
|
|
Loading…
Reference in New Issue