Hi all. I have a dataset where I would like to calculate cumulative sums, moving averages etc

Using iris I can nest by species

```
nested <- iris %>%
group_by(Species) %>%
nest()
```

And then

```
nested %>%
mutate(cumulative = map(data, cumsum)) %>%
unnest()
```

Which gives me a df with all the cumulative values at the end. Perfect

A tibble: 150 x 9

Groups: Species [3]

Species Sepal.Length Sepal.Width Petal.Length Petal.Width Sepal.Length1

1 setosa 5.1 3.5 1.4 0.2 5.1

2 setosa 4.9 3 1.4 0.2 10

3 setosa 4.7 3.2 1.3 0.2 14.7

4 setosa 4.6 3.1 1.5 0.2 19.3

5 setosa 5 3.6 1.4 0.2 24.3

6 setosa 5.4 3.9 1.7 0.4 29.7

7 setosa 4.6 3.4 1.4 0.3 34.3

8 setosa 5 3.4 1.5 0.2 39.3

9 setosa 4.4 2.9 1.4 0.2 43.7

10 setosa 4.9 3.1 1.5 0.1 48.6

... with 140 more rows, and 3 more variables: Sepal.Width1 ,

Petal.Length1 , Petal.Width1

I wanted to use movavg from the pracma package (with moving average of 6) on iris and have used the following and variations of the code with no luck. For example the below gives: Error in movavg(x = data, n = 6) : is.numeric(x) is not TRUE

```
nested %>%
mutate(movingaverage = map(data, movavg(n = 6))) %>%
unnest()
```

New to R and purrr in particular so any help would be much appreciated