I'm trying to look though lots of data and see what categories have had the most drastic change over time. I was thinking that calculating the slope of the normalized values per row would give me that information, but I seem to be lost on how to get that.

```
category <- c("red","blue","black","orange")
yr2016 <- c(1,20,4,8)
yr2017 <- c(3,24,5,1)
yr2018 <- c(5,28,9,4)
df <- data.frame(
category=category,
yr2016=yr2016,
yr2017=yr2017,
yr2018=yr2018
)
df
```

What I want to achieve is first normalize the values so it would look like this.

```
category <- c("red","blue","black","orange")
yr2016 <- c(-1.00, -1.00, -0.76, 1.04)
yr2017 <- c(0.00, 0.00, -0.38, -0.95)
yr2018 <- c(1.00, 1.00, 1.13, -0.09)
df <- data.frame(
category=category,
yr2016=yr2016,
yr2017=yr2017,
yr2018=yr2018
)
df
```

and then make it to this where I have the slope for each category

```
category <- c("red","blue","black","orange")
slope <- c(1.00, 1.00, 0.94, -0.57)
df <- data.frame(
category=category,
slope = slope
)
df
```

For the life of me, I'm drawing a blank on how to do his. I've done it in Excel, but I'm figuring out how to transition my method.

I'm open to other suggestions for figuring this out if slope isn't the best way.