title: Scraping from more than one aspx pages with R
body: <p>I am a linguistics student doing experiments in R. I have been looking at other questions and got a lot of help, but I am stuck at the moment as I cannot implement example functions to my case and would love to have some help. </p>
  
  <p>First, I would like to go through every semester from here: <a href="http://registration.boun.edu.tr/schedule.htm" rel="nofollow noreferrer">http://registration.boun.edu.tr/schedule.htm</a>, and every department here: <a href="http://registration.boun.edu.tr/scripts/schdepsel.asp" rel="nofollow noreferrer">http://registration.boun.edu.tr/scripts/schdepsel.asp</a></p>
  
  <p>It is actually a bit easy to generate the list of it as the final link is something like this: <a href="http://registration.boun.edu.tr/scripts/sch.asp?donem=2017/2018-3&amp;kisaadi=ATA&amp;bolum=ATATURK+INSTITUTE+FOR+MODERN+TURKISH+HISTORY" rel="nofollow noreferrer">http://registration.boun.edu.tr/scripts/sch.asp?donem=2017/2018-3&amp;kisaadi=ATA&amp;bolum=ATATURK+INSTITUTE+FOR+MODERN+TURKISH+HISTORY</a></p>
  
  <p>Secondly, I need to select the code, name, days and hours of the course and tag the semester, which I did. (probably, I did it extremely poorly, but I did it nevertheless, yay!)</p>
  
  <pre><code>library("rvest")
  library("dplyr")
  library("magrittr")
  
  # define the html
  reg &lt;- read_html("http://registration.boun.edu.tr/scripts/sch.asp?donem=2017/2018-3&amp;kisaadi=ATA&amp;bolum=ATATURK+INSTITUTE+FOR+MODERN+TURKISH+HISTORY")
  
  # make the html a list of tables
  regtable &lt;- reg %&gt;% html_table(fill = TRUE) 
  
  # tag their year
  regtable[[4]][ ,15] &lt;- regtable[[1]][1,2]
  regtable[[4]][1,15] &lt;- "Semester"
  
  # Change the Days and Hours to sth usable, but how and to what?
    # parse the dates, T and Th problem?
    # parse the hour 10th hour problem?
  
  # get the necessary info
  regtable &lt;- regtable %&gt;% .[4] %&gt;%  as.data.frame() %&gt;% select( . , X1 , X3 , X8 , X9 , V15)
  
  # correct the names
  names(regtable) &lt;- regtable[1,]
  regtable &lt;- regtable[-1,]
  View(regtable)
  </code></pre>
  
  <p>But the problem is that I want to write a function where I can do this for more than 20 semester and more than 50 departments. Any help would be great! I am doing this so that I can work on optimization for class hours for my department.</p>
  
  <p>I guess I can do this better with XML Package, but I could not understand how to use it.</p>
  
  <p>Thanks for any help,
  Utku</p>