I’m still new to R and I’ve been struggling with this issue for a couple of days. I found some solutions but I’m looking for a short code and I’d rather avoid a loop but so far that’s all I could come up with.
My data is the following :
[![enter image description here](https://i.stack.imgur.com/24R2m.png)](https://i.stack.imgur.com/24R2m.png)

The way I want it to look is the following:

```
Country    Year       ATM      POS  
France     2015        1       10    
France     2014        5        2    
France     2013       12        4     
France     2012        2       12   

```

I haven’t found a short way to go about this so I broke it down into steps : I disabled headers, tried to make a vector out of the 1 row and I figured I’d do a pivot longer on the years first but I get an error on this :

```
ATM <- pivot_longer(data = dat, cols = dat[,2:6],names_to = "Year",values_to = headervector) 

```

This would also require a loop for the POS part.
So, beyond fixing this, would there be a better approach that doesn’t require a loop?

Thank you so much!