title: How to split dataframe into multiple dataframes by column index
body: <p>I'm trying to process the weather data specified below. I thought I was on the right track but the pivot_longer is not being used in the correct manor and is causing partial duplicates.</p>
  <p>Can anyone offer any suggestions as to how I can edit my code? I guess one way would be to perform the pivot_longer after splitting the dataframe into several dataframes i.e. first dataframe - jan, year, second dataframe - feb, year.</p>
  <pre><code>maxT &lt;- read.table('https://www.metoffice.gov.uk/pub/data/weather/uk/climate/datasets/Tmax/ranked/England_S.txt',  skip = 5, header = TRUE) %&gt;%
    select(c(1:24)) %&gt;%
    pivot_longer(cols = seq(2,24,2) , values_to = &quot;year&quot;) %&gt;%
    mutate_at(c(1:12), ~as.numeric(as.character(.))) %&gt;%
    pivot_longer(cols = c(1:12), names_to = &quot;month&quot;, values_to = &quot;tmax&quot;) %&gt;%
    mutate(month = match(str_to_title(month), month.abb),
           date = as.Date(paste(year, month, 1, sep = &quot;-&quot;), format = &quot;%Y-%m-%d&quot;)) %&gt;%
    select(-c(&quot;name&quot;,&quot;year&quot;,&quot;month&quot;)) %&gt;%
    arrange(date)
  </code></pre>