I came across the following (stylized) data cleaning problem:

```r
df <- data.frame(first_column  = c("country1", "variable1", "variable2","country2", "variable1", "variable2"),
                 second_column = c(NA, "15", "16", NA, "62", "63")
)

df     
#>   first_column second_column
#> 1     country1          <NA>
#> 2    variable1            15
#> 3    variable2            16
#> 4     country2          <NA>
#> 5    variable1            62
#> 6    variable2            63

```

Created on 2020-11-02 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)

I was trying to convert this to a "tidy" (i.e. long or wide format) using `pivot_longer_spec` and `pivot_wider_spec` respectively, but couldn't work it out. There seems to be very little documentation on these functions, and it is difficult for me to find out how to specify the arguments correctly.

Can anyone tell me how to approach this problem, using either these functions or others?

Many thanks.