I currently have hourly temperature data for the whole year. a small subset of it is here

```
Date     Temp
1/1/21   11
2/1/21   12
3/1/21   13
4/1/21   14
5/1/21   15
6/1/21   10
7/1/21   11
8/1/21   12
9/1/21   16
10/1/21  15 

```

From this very community, I know to calculate moving averages, I would do

```
matemp <- zoo::rollmean(x = df$Temp, k = 2, align = "left", fill = NA )

```

Q1: if I want the new df displayed, would it be

```
newdf <- c(df, matemp)

```

This will produce a list not a vector?

I understand there is a difference in length but not sure what people do to deal with it.

Q2: From here, I'm hoping to identify outliers using the following criteria, if the temperature is larger than MA then return a 1 otherwise return 0. Would piping makes the most amount of sense here?

The final df should hopefully have the following columns:
Date
Temp
MA
Binary

Thank you.