I have some data such as the following:

```
               out.1     out.2     out.3     out.4     out.5    out.6     out.7       out.8
2019-12-20 -9118.462 0.5148290 -4210.862 0.2392312 -25617.24 1.477824 -117.1599 0.009566374
2019-12-23 -9184.199 0.5184467 -4174.941 0.2372643 -24958.84 1.441691 -137.0917 0.010663508
2019-12-24 -9266.843 0.5229899 -4249.715 0.2413671 -24969.00 1.442210 -172.7355 0.012622419
2019-12-26 -9258.131 0.5225351 -4288.231 0.2434834 -24350.91 1.408318 -201.3660 0.014197360
2019-12-27 -9143.157 0.5162509 -4393.797 0.2492755 -23108.32 1.340162 -243.3737 0.016505916
2019-12-30 -9242.121 0.5216966 -4330.111 0.2457817 -20755.14 1.211073 -253.7144 0.017076434
               out.9    out.10
2019-12-20 -7643.492 0.4311371
2019-12-23 -8415.101 0.4734893
2019-12-24 -9152.893 0.5139774
2019-12-26 -9662.127 0.5419248
2019-12-27 -9998.823 0.5603993
2019-12-30 -9923.590 0.5562694

```

I want to rename the columns based on the `categories`. Expected column names output would be.

```
       cat1_int     cat1_slp     cat2_int     cat2_slp     cat3_int    cat3_slp     cat4_int       cat4_slp                   cat5_int    cat5_slp

```

That is, columns 1 `out.1` and 2 `out.2` correspond to the `cat1` category so I want to `paste` the following:

```
paste(categories, "int", sep = "_")
paste(categories, "slp", sep = "_")

```

Data:

```
categories <- c("cat1", "cat2", "cat3", "cat4", "cat5")

dat <- structure(list(out.1 = c(-9118.46197704162, -9184.1990258304, 
-9266.84288232753, -9258.13067005911, -9143.1568692775, -9242.12147823929
), out.2 = c(0.514829049123844, 0.518446746505272, 0.522989933275129, 
0.522535133051743, 0.516250859225689, 0.521696583045444), out.3 = c(-4210.86211924362, 
-4174.94130293284, -4249.71533822444, -4288.23099991079, -4393.79652094767, 
-4330.11095933905), out.4 = c(0.239231206297855, 0.237264257577954, 
0.241367122864574, 0.243483361228441, 0.24927554155442, 0.245781685504571
), out.5 = c(-25617.2445147917, -24958.8430574604, -24969.0035323288, 
-24350.9051523239, -23108.3159515496, -20755.1372077918), out.6 = c(1.47782413739037, 
1.44169134643833, 1.44220957860003, 1.40831782004575, 1.34016247703999, 
1.211073355198), out.7 = c(-117.159880997545, -137.091697540613, 
-172.735462324571, -201.365975913688, -243.373675584194, -253.71437646554
), out.8 = c(0.00956637430190151, 0.0106635081720309, 0.0126224187980374, 
0.0141973601724743, 0.0165059159917159, 0.0170764337924975), 
    out.9 = c(-7643.49240697189, -8415.10092588956, -9152.89318342571, 
    -9662.12684043904, -9998.82325483165, -9923.59048928443), 
    out.10 = c(0.431137080760586, 0.473489338963575, 0.513977369169968, 
    0.541924828229497, 0.560399279245172, 0.556269392485137)), row.names = c("2019-12-20", 
"2019-12-23", "2019-12-24", "2019-12-26", "2019-12-27", "2019-12-30"
), class = "data.frame")

```