#############################################################################################
# This Code does the Following:
    # 1. Open the online library for * University 
    # 2. Follow the Dissertation links
    # 3. Scrap the Infomartion for Economics Students
    # 4. Export the results into an Excel file named * University


# Created by Paul Sirma October 2015
############################################################################################

library(rvest)
## Warning: package 'rvest' was built under R version 3.0.3
library(CSS)
## Warning: package 'CSS' was built under R version 3.0.3
## Loading required package: XML
## Warning: package 'XML' was built under R version 3.0.3
## 
## Attaching package: 'XML'
## 
## The following object is masked from 'package:rvest':
## 
##     xml
## 
## Loading required package: stringr
## Warning: package 'stringr' was built under R version 3.0.3
library(bitops)
library(RCurl)
## Warning: package 'RCurl' was built under R version 3.0.3
# **********************************    Brown University  *************************************** #
###################################################################################################


#1. General Economics 
# **************************
#***************************

s <- html_session("https://search.library.brown.edu/catalog?f%5Bformat%5D%5B%5D=Thesis%2FDissertation&f%5Btopic_facet%5D%5B%5D=Economics%2C+General&per_page=100&q=dissertation&range%5Bpub_date%5D%5Bbegin%5D=2008&range%5Bpub_date%5D%5Bend%5D=2013&search_field=dummy_range") 
is.session(s)
## [1] TRUE
p <- s%>% follow_link(css=".col-lg-10 a") 
## Navigating to /catalog/b5766015
##Retriving the infomation we want 
Title <-   html(p) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays on banking and urban economic development"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(p) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Feler, Leo"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(p) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economic development > Brazil."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(p) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2010."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(p) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "Advisor: J. Vernon Henderson."
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page1 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page1
##      Author       Advisor                        
## [1,] "Feler, Leo" "Advisor: J. Vernon Henderson."
##      Subject                         
## [1,] "Economic development > Brazil."
##      Title                                              Publish_Year
## [1,] "Essays on banking and urban economic development" "2010."
##The second publication 
q <- s%>% follow_link(css="#documents :nth-child(2) .col-lg-10 a") 
## Navigating to /catalog/b4764210
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Politics, competition, and the media"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Chiang, Chun-Fang"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economics, General."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page2 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page2
##      Author              Advisor Subject              
## [1,] "Chiang, Chun-Fang" NA      "Economics, General."
##      Title                                  Publish_Year
## [1,] "Politics, competition, and the media" "2008."
data <- rbind(page1, page2)
data
##      Author              Advisor                        
## [1,] "Feler, Leo"        "Advisor: J. Vernon Henderson."
## [2,] "Chiang, Chun-Fang" NA                             
##      Subject                         
## [1,] "Economic development > Brazil."
## [2,] "Economics, General."           
##      Title                                              Publish_Year
## [1,] "Essays on banking and urban economic development" "2010."     
## [2,] "Politics, competition, and the media"             "2008."
##The Third publication 
q <- s%>% follow_link(css="#documents :nth-child(3) .col-lg-10 a") 
## Navigating to /catalog/b5397445
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Three essays in instrumental variables"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Kitagawa, Toru"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Instrumental variables (Statistics)"
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2009."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "Includes bibliographical references."
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author           Advisor                               
## [1,] "Kitagawa, Toru" "Includes bibliographical references."
##      Subject                              
## [1,] "Instrumental variables (Statistics)"
##      Title                                    Publish_Year
## [1,] "Three essays in instrumental variables" "2009."
data<- rbind(data,page3)
data
##      Author              Advisor                               
## [1,] "Feler, Leo"        "Advisor: J. Vernon Henderson."       
## [2,] "Chiang, Chun-Fang" NA                                    
## [3,] "Kitagawa, Toru"    "Includes bibliographical references."
##      Subject                              
## [1,] "Economic development > Brazil."     
## [2,] "Economics, General."                
## [3,] "Instrumental variables (Statistics)"
##      Title                                              Publish_Year
## [1,] "Essays on banking and urban economic development" "2010."     
## [2,] "Politics, competition, and the media"             "2008."     
## [3,] "Three essays in instrumental variables"           "2009."
##The Four publication 
q <- s%>% follow_link(css="#documents :nth-child(4) .col-lg-10 a") 
## Navigating to /catalog/b5397444
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Voluntary compliance, pollution levels, and infant health"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Gutierrez Fernandez, Emilio"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Environmental policy > Developing countries."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2009."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author                        Advisor
## [1,] "Gutierrez Fernandez, Emilio" NA     
##      Subject                                       
## [1,] "Environmental policy > Developing countries."
##      Title                                                      
## [1,] "Voluntary compliance, pollution levels, and infant health"
##      Publish_Year
## [1,] "2009."
data<- rbind(data,page3)
data
##      Author                        Advisor                               
## [1,] "Feler, Leo"                  "Advisor: J. Vernon Henderson."       
## [2,] "Chiang, Chun-Fang"           NA                                    
## [3,] "Kitagawa, Toru"              "Includes bibliographical references."
## [4,] "Gutierrez Fernandez, Emilio" NA                                    
##      Subject                                       
## [1,] "Economic development > Brazil."              
## [2,] "Economics, General."                         
## [3,] "Instrumental variables (Statistics)"         
## [4,] "Environmental policy > Developing countries."
##      Title                                                      
## [1,] "Essays on banking and urban economic development"         
## [2,] "Politics, competition, and the media"                     
## [3,] "Three essays in instrumental variables"                   
## [4,] "Voluntary compliance, pollution levels, and infant health"
##      Publish_Year
## [1,] "2010."     
## [2,] "2008."     
## [3,] "2009."     
## [4,] "2009."
##The five publication 
q <- s%>% follow_link(css="#documents :nth-child(5) .col-lg-10 a") 
## Navigating to /catalog/b4764228
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays in applied microeconomics"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Wilson, Nicholas L."
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "History, United States."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author                Advisor Subject                  
## [1,] "Wilson, Nicholas L." NA      "History, United States."
##      Title                              Publish_Year
## [1,] "Essays in applied microeconomics" "2008."
data<- rbind(data,page3)
data
##      Author                        Advisor                               
## [1,] "Feler, Leo"                  "Advisor: J. Vernon Henderson."       
## [2,] "Chiang, Chun-Fang"           NA                                    
## [3,] "Kitagawa, Toru"              "Includes bibliographical references."
## [4,] "Gutierrez Fernandez, Emilio" NA                                    
## [5,] "Wilson, Nicholas L."         NA                                    
##      Subject                                       
## [1,] "Economic development > Brazil."              
## [2,] "Economics, General."                         
## [3,] "Instrumental variables (Statistics)"         
## [4,] "Environmental policy > Developing countries."
## [5,] "History, United States."                     
##      Title                                                      
## [1,] "Essays on banking and urban economic development"         
## [2,] "Politics, competition, and the media"                     
## [3,] "Three essays in instrumental variables"                   
## [4,] "Voluntary compliance, pollution levels, and infant health"
## [5,] "Essays in applied microeconomics"                         
##      Publish_Year
## [1,] "2010."     
## [2,] "2008."     
## [3,] "2009."     
## [4,] "2009."     
## [5,] "2008."
##The Six publication 
q <- s%>% follow_link(css="#documents :nth-child(6) .col-lg-10 a") 
## Navigating to /catalog/b4764222
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays on the historical determinants of comparative economic development"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Michalopoulos, Stylianos G."
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Geography."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author                        Advisor Subject     
## [1,] "Michalopoulos, Stylianos G." NA      "Geography."
##      Title                                                                      
## [1,] "Essays on the historical determinants of comparative economic development"
##      Publish_Year
## [1,] "2008."
data<- rbind(data,page3)
data
##      Author                        Advisor                               
## [1,] "Feler, Leo"                  "Advisor: J. Vernon Henderson."       
## [2,] "Chiang, Chun-Fang"           NA                                    
## [3,] "Kitagawa, Toru"              "Includes bibliographical references."
## [4,] "Gutierrez Fernandez, Emilio" NA                                    
## [5,] "Wilson, Nicholas L."         NA                                    
## [6,] "Michalopoulos, Stylianos G." NA                                    
##      Subject                                       
## [1,] "Economic development > Brazil."              
## [2,] "Economics, General."                         
## [3,] "Instrumental variables (Statistics)"         
## [4,] "Environmental policy > Developing countries."
## [5,] "History, United States."                     
## [6,] "Geography."                                  
##      Title                                                                      
## [1,] "Essays on banking and urban economic development"                         
## [2,] "Politics, competition, and the media"                                     
## [3,] "Three essays in instrumental variables"                                   
## [4,] "Voluntary compliance, pollution levels, and infant health"                
## [5,] "Essays in applied microeconomics"                                         
## [6,] "Essays on the historical determinants of comparative economic development"
##      Publish_Year
## [1,] "2010."     
## [2,] "2008."     
## [3,] "2009."     
## [4,] "2009."     
## [5,] "2008."     
## [6,] "2008."
##The Seven publication 
q <- s%>% follow_link(css="#documents :nth-child(7) .col-lg-10 a") 
## Navigating to /catalog/b4764206
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Externalities in global public health"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Bennett, Daniel M."
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economics, General."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author               Advisor Subject              
## [1,] "Bennett, Daniel M." NA      "Economics, General."
##      Title                                   Publish_Year
## [1,] "Externalities in global public health" "2008."
data<- rbind(data,page3)
data
##      Author                        Advisor                               
## [1,] "Feler, Leo"                  "Advisor: J. Vernon Henderson."       
## [2,] "Chiang, Chun-Fang"           NA                                    
## [3,] "Kitagawa, Toru"              "Includes bibliographical references."
## [4,] "Gutierrez Fernandez, Emilio" NA                                    
## [5,] "Wilson, Nicholas L."         NA                                    
## [6,] "Michalopoulos, Stylianos G." NA                                    
## [7,] "Bennett, Daniel M."          NA                                    
##      Subject                                       
## [1,] "Economic development > Brazil."              
## [2,] "Economics, General."                         
## [3,] "Instrumental variables (Statistics)"         
## [4,] "Environmental policy > Developing countries."
## [5,] "History, United States."                     
## [6,] "Geography."                                  
## [7,] "Economics, General."                         
##      Title                                                                      
## [1,] "Essays on banking and urban economic development"                         
## [2,] "Politics, competition, and the media"                                     
## [3,] "Three essays in instrumental variables"                                   
## [4,] "Voluntary compliance, pollution levels, and infant health"                
## [5,] "Essays in applied microeconomics"                                         
## [6,] "Essays on the historical determinants of comparative economic development"
## [7,] "Externalities in global public health"                                    
##      Publish_Year
## [1,] "2010."     
## [2,] "2008."     
## [3,] "2009."     
## [4,] "2009."     
## [5,] "2008."     
## [6,] "2008."     
## [7,] "2008."
##The 8 publication 
q <- s%>% follow_link(css="#documents :nth-child(8) .col-lg-10 a") 
## Navigating to /catalog/b4764125
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Macroeconomics for credit market imperfections and heterogeneous agents"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Kunieda, Takuma"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Macroeconomics."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "Thesis (Ph.D.)--Brown University, 2008."
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author            Advisor                                  
## [1,] "Kunieda, Takuma" "Thesis (Ph.D.)--Brown University, 2008."
##      Subject          
## [1,] "Macroeconomics."
##      Title                                                                    
## [1,] "Macroeconomics for credit market imperfections and heterogeneous agents"
##      Publish_Year
## [1,] "2008."
data<- rbind(data,page3)
data
##      Author                       
## [1,] "Feler, Leo"                 
## [2,] "Chiang, Chun-Fang"          
## [3,] "Kitagawa, Toru"             
## [4,] "Gutierrez Fernandez, Emilio"
## [5,] "Wilson, Nicholas L."        
## [6,] "Michalopoulos, Stylianos G."
## [7,] "Bennett, Daniel M."         
## [8,] "Kunieda, Takuma"            
##      Advisor                                  
## [1,] "Advisor: J. Vernon Henderson."          
## [2,] NA                                       
## [3,] "Includes bibliographical references."   
## [4,] NA                                       
## [5,] NA                                       
## [6,] NA                                       
## [7,] NA                                       
## [8,] "Thesis (Ph.D.)--Brown University, 2008."
##      Subject                                       
## [1,] "Economic development > Brazil."              
## [2,] "Economics, General."                         
## [3,] "Instrumental variables (Statistics)"         
## [4,] "Environmental policy > Developing countries."
## [5,] "History, United States."                     
## [6,] "Geography."                                  
## [7,] "Economics, General."                         
## [8,] "Macroeconomics."                             
##      Title                                                                      
## [1,] "Essays on banking and urban economic development"                         
## [2,] "Politics, competition, and the media"                                     
## [3,] "Three essays in instrumental variables"                                   
## [4,] "Voluntary compliance, pollution levels, and infant health"                
## [5,] "Essays in applied microeconomics"                                         
## [6,] "Essays on the historical determinants of comparative economic development"
## [7,] "Externalities in global public health"                                    
## [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##      Publish_Year
## [1,] "2010."     
## [2,] "2008."     
## [3,] "2009."     
## [4,] "2009."     
## [5,] "2008."     
## [6,] "2008."     
## [7,] "2008."     
## [8,] "2008."
##The 9 publication 
q <- s%>% follow_link(css="#documents :nth-child(9) .col-lg-10 a") 
## Navigating to /catalog/b4764225
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Provision of natural and human resources in developing economies"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Sekhri, Sheetal"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economics, General."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author            Advisor Subject              
## [1,] "Sekhri, Sheetal" NA      "Economics, General."
##      Title                                                             
## [1,] "Provision of natural and human resources in developing economies"
##      Publish_Year
## [1,] "2008."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
##       Advisor                                  
##  [1,] "Advisor: J. Vernon Henderson."          
##  [2,] NA                                       
##  [3,] "Includes bibliographical references."   
##  [4,] NA                                       
##  [5,] NA                                       
##  [6,] NA                                       
##  [7,] NA                                       
##  [8,] "Thesis (Ph.D.)--Brown University, 2008."
##  [9,] NA                                       
##       Subject                                       
##  [1,] "Economic development > Brazil."              
##  [2,] "Economics, General."                         
##  [3,] "Instrumental variables (Statistics)"         
##  [4,] "Environmental policy > Developing countries."
##  [5,] "History, United States."                     
##  [6,] "Geography."                                  
##  [7,] "Economics, General."                         
##  [8,] "Macroeconomics."                             
##  [9,] "Economics, General."                         
##       Title                                                                      
##  [1,] "Essays on banking and urban economic development"                         
##  [2,] "Politics, competition, and the media"                                     
##  [3,] "Three essays in instrumental variables"                                   
##  [4,] "Voluntary compliance, pollution levels, and infant health"                
##  [5,] "Essays in applied microeconomics"                                         
##  [6,] "Essays on the historical determinants of comparative economic development"
##  [7,] "Externalities in global public health"                                    
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##  [9,] "Provision of natural and human resources in developing economies"         
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."
##The 10 publication 
q <- s%>% follow_link(css="#documents :nth-child(10) .col-lg-10 a") 
## Navigating to /catalog/b5766019
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays in the economics of education and child labor"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Switala, André"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Child labor > Developing countries."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2010."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "Vita."
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author           Advisor Subject                              
## [1,] "Switala, André" "Vita." "Child labor > Developing countries."
##      Title                                                  Publish_Year
## [1,] "Essays in the economics of education and child labor" "2010."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
## [10,] "Switala, André"             
##       Advisor                                  
##  [1,] "Advisor: J. Vernon Henderson."          
##  [2,] NA                                       
##  [3,] "Includes bibliographical references."   
##  [4,] NA                                       
##  [5,] NA                                       
##  [6,] NA                                       
##  [7,] NA                                       
##  [8,] "Thesis (Ph.D.)--Brown University, 2008."
##  [9,] NA                                       
## [10,] "Vita."                                  
##       Subject                                       
##  [1,] "Economic development > Brazil."              
##  [2,] "Economics, General."                         
##  [3,] "Instrumental variables (Statistics)"         
##  [4,] "Environmental policy > Developing countries."
##  [5,] "History, United States."                     
##  [6,] "Geography."                                  
##  [7,] "Economics, General."                         
##  [8,] "Macroeconomics."                             
##  [9,] "Economics, General."                         
## [10,] "Child labor > Developing countries."         
##       Title                                                                      
##  [1,] "Essays on banking and urban economic development"                         
##  [2,] "Politics, competition, and the media"                                     
##  [3,] "Three essays in instrumental variables"                                   
##  [4,] "Voluntary compliance, pollution levels, and infant health"                
##  [5,] "Essays in applied microeconomics"                                         
##  [6,] "Essays on the historical determinants of comparative economic development"
##  [7,] "Externalities in global public health"                                    
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##  [9,] "Provision of natural and human resources in developing economies"         
## [10,] "Essays in the economics of education and child labor"                     
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."     
## [10,] "2010."
##The 11 publication 
q <- s%>% follow_link(css="#documents :nth-child(11) .col-lg-10 a") 
## Navigating to /catalog/b5766020
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Three essays on child labor"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Vargas, Carmiña O."
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Child labor > Developing countries."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2010."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "Chapter 1 co-written with André Switala."
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author               Advisor                                   
## [1,] "Vargas, Carmiña O." "Chapter 1 co-written with André Switala."
##      Subject                               Title                        
## [1,] "Child labor > Developing countries." "Three essays on child labor"
##      Publish_Year
## [1,] "2010."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
## [10,] "Switala, André"             
## [11,] "Vargas, Carmiña O."         
##       Advisor                                   
##  [1,] "Advisor: J. Vernon Henderson."           
##  [2,] NA                                        
##  [3,] "Includes bibliographical references."    
##  [4,] NA                                        
##  [5,] NA                                        
##  [6,] NA                                        
##  [7,] NA                                        
##  [8,] "Thesis (Ph.D.)--Brown University, 2008." 
##  [9,] NA                                        
## [10,] "Vita."                                   
## [11,] "Chapter 1 co-written with André Switala."
##       Subject                                       
##  [1,] "Economic development > Brazil."              
##  [2,] "Economics, General."                         
##  [3,] "Instrumental variables (Statistics)"         
##  [4,] "Environmental policy > Developing countries."
##  [5,] "History, United States."                     
##  [6,] "Geography."                                  
##  [7,] "Economics, General."                         
##  [8,] "Macroeconomics."                             
##  [9,] "Economics, General."                         
## [10,] "Child labor > Developing countries."         
## [11,] "Child labor > Developing countries."         
##       Title                                                                      
##  [1,] "Essays on banking and urban economic development"                         
##  [2,] "Politics, competition, and the media"                                     
##  [3,] "Three essays in instrumental variables"                                   
##  [4,] "Voluntary compliance, pollution levels, and infant health"                
##  [5,] "Essays in applied microeconomics"                                         
##  [6,] "Essays on the historical determinants of comparative economic development"
##  [7,] "Externalities in global public health"                                    
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##  [9,] "Provision of natural and human resources in developing economies"         
## [10,] "Essays in the economics of education and child labor"                     
## [11,] "Three essays on child labor"                                              
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."     
## [10,] "2010."     
## [11,] "2010."
##The 12 publication 
q <- s%>% follow_link(css="#documents :nth-child(12) .col-lg-10 a") 
## Navigating to /catalog/b4764116
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays in economics and finance"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Iliev, Peter"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economics."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "Thesis (Ph.D.)--Brown University, 2008."
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author         Advisor                                   Subject     
## [1,] "Iliev, Peter" "Thesis (Ph.D.)--Brown University, 2008." "Economics."
##      Title                             Publish_Year
## [1,] "Essays in economics and finance" "2008."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
## [10,] "Switala, André"             
## [11,] "Vargas, Carmiña O."         
## [12,] "Iliev, Peter"               
##       Advisor                                   
##  [1,] "Advisor: J. Vernon Henderson."           
##  [2,] NA                                        
##  [3,] "Includes bibliographical references."    
##  [4,] NA                                        
##  [5,] NA                                        
##  [6,] NA                                        
##  [7,] NA                                        
##  [8,] "Thesis (Ph.D.)--Brown University, 2008." 
##  [9,] NA                                        
## [10,] "Vita."                                   
## [11,] "Chapter 1 co-written with André Switala."
## [12,] "Thesis (Ph.D.)--Brown University, 2008." 
##       Subject                                       
##  [1,] "Economic development > Brazil."              
##  [2,] "Economics, General."                         
##  [3,] "Instrumental variables (Statistics)"         
##  [4,] "Environmental policy > Developing countries."
##  [5,] "History, United States."                     
##  [6,] "Geography."                                  
##  [7,] "Economics, General."                         
##  [8,] "Macroeconomics."                             
##  [9,] "Economics, General."                         
## [10,] "Child labor > Developing countries."         
## [11,] "Child labor > Developing countries."         
## [12,] "Economics."                                  
##       Title                                                                      
##  [1,] "Essays on banking and urban economic development"                         
##  [2,] "Politics, competition, and the media"                                     
##  [3,] "Three essays in instrumental variables"                                   
##  [4,] "Voluntary compliance, pollution levels, and infant health"                
##  [5,] "Essays in applied microeconomics"                                         
##  [6,] "Essays on the historical determinants of comparative economic development"
##  [7,] "Externalities in global public health"                                    
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##  [9,] "Provision of natural and human resources in developing economies"         
## [10,] "Essays in the economics of education and child labor"                     
## [11,] "Three essays on child labor"                                              
## [12,] "Essays in economics and finance"                                          
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."     
## [10,] "2010."     
## [11,] "2010."     
## [12,] "2008."
##The 13 publication 
q <- s%>% follow_link(css="#documents :nth-child(13) .col-lg-10 a") 
## Navigating to /catalog/b4764217
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays on multinational enterprises"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Ito, Yukiko"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economics, General."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author        Advisor Subject              
## [1,] "Ito, Yukiko" NA      "Economics, General."
##      Title                                 Publish_Year
## [1,] "Essays on multinational enterprises" "2008."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
## [10,] "Switala, André"             
## [11,] "Vargas, Carmiña O."         
## [12,] "Iliev, Peter"               
## [13,] "Ito, Yukiko"                
##       Advisor                                   
##  [1,] "Advisor: J. Vernon Henderson."           
##  [2,] NA                                        
##  [3,] "Includes bibliographical references."    
##  [4,] NA                                        
##  [5,] NA                                        
##  [6,] NA                                        
##  [7,] NA                                        
##  [8,] "Thesis (Ph.D.)--Brown University, 2008." 
##  [9,] NA                                        
## [10,] "Vita."                                   
## [11,] "Chapter 1 co-written with André Switala."
## [12,] "Thesis (Ph.D.)--Brown University, 2008." 
## [13,] NA                                        
##       Subject                                       
##  [1,] "Economic development > Brazil."              
##  [2,] "Economics, General."                         
##  [3,] "Instrumental variables (Statistics)"         
##  [4,] "Environmental policy > Developing countries."
##  [5,] "History, United States."                     
##  [6,] "Geography."                                  
##  [7,] "Economics, General."                         
##  [8,] "Macroeconomics."                             
##  [9,] "Economics, General."                         
## [10,] "Child labor > Developing countries."         
## [11,] "Child labor > Developing countries."         
## [12,] "Economics."                                  
## [13,] "Economics, General."                         
##       Title                                                                      
##  [1,] "Essays on banking and urban economic development"                         
##  [2,] "Politics, competition, and the media"                                     
##  [3,] "Three essays in instrumental variables"                                   
##  [4,] "Voluntary compliance, pollution levels, and infant health"                
##  [5,] "Essays in applied microeconomics"                                         
##  [6,] "Essays on the historical determinants of comparative economic development"
##  [7,] "Externalities in global public health"                                    
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##  [9,] "Provision of natural and human resources in developing economies"         
## [10,] "Essays in the economics of education and child labor"                     
## [11,] "Three essays on child labor"                                              
## [12,] "Essays in economics and finance"                                          
## [13,] "Essays on multinational enterprises"                                      
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."     
## [10,] "2010."     
## [11,] "2010."     
## [12,] "2008."     
## [13,] "2008."
##The 14 publication 
q <- s%>% follow_link(css="#documents :nth-child(14) .col-lg-10 a") 
## Navigating to /catalog/b4764105
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Essays on the health reform and health outcomes in Colombia"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Camacho, Adriana"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Terrorism > Colombia > Psychological aspects."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## [1] "\n                9780549674634\n            "
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author             Advisor                                        
## [1,] "Camacho, Adriana" "\n                9780549674634\n            "
##      Subject                                        
## [1,] "Terrorism > Colombia > Psychological aspects."
##      Title                                                        
## [1,] "Essays on the health reform and health outcomes in Colombia"
##      Publish_Year
## [1,] "2008."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
## [10,] "Switala, André"             
## [11,] "Vargas, Carmiña O."         
## [12,] "Iliev, Peter"               
## [13,] "Ito, Yukiko"                
## [14,] "Camacho, Adriana"           
##       Advisor                                        
##  [1,] "Advisor: J. Vernon Henderson."                
##  [2,] NA                                             
##  [3,] "Includes bibliographical references."         
##  [4,] NA                                             
##  [5,] NA                                             
##  [6,] NA                                             
##  [7,] NA                                             
##  [8,] "Thesis (Ph.D.)--Brown University, 2008."      
##  [9,] NA                                             
## [10,] "Vita."                                        
## [11,] "Chapter 1 co-written with André Switala."     
## [12,] "Thesis (Ph.D.)--Brown University, 2008."      
## [13,] NA                                             
## [14,] "\n                9780549674634\n            "
##       Subject                                        
##  [1,] "Economic development > Brazil."               
##  [2,] "Economics, General."                          
##  [3,] "Instrumental variables (Statistics)"          
##  [4,] "Environmental policy > Developing countries." 
##  [5,] "History, United States."                      
##  [6,] "Geography."                                   
##  [7,] "Economics, General."                          
##  [8,] "Macroeconomics."                              
##  [9,] "Economics, General."                          
## [10,] "Child labor > Developing countries."          
## [11,] "Child labor > Developing countries."          
## [12,] "Economics."                                   
## [13,] "Economics, General."                          
## [14,] "Terrorism > Colombia > Psychological aspects."
##       Title                                                                      
##  [1,] "Essays on banking and urban economic development"                         
##  [2,] "Politics, competition, and the media"                                     
##  [3,] "Three essays in instrumental variables"                                   
##  [4,] "Voluntary compliance, pollution levels, and infant health"                
##  [5,] "Essays in applied microeconomics"                                         
##  [6,] "Essays on the historical determinants of comparative economic development"
##  [7,] "Externalities in global public health"                                    
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"  
##  [9,] "Provision of natural and human resources in developing economies"         
## [10,] "Essays in the economics of education and child labor"                     
## [11,] "Three essays on child labor"                                              
## [12,] "Essays in economics and finance"                                          
## [13,] "Essays on multinational enterprises"                                      
## [14,] "Essays on the health reform and health outcomes in Colombia"              
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."     
## [10,] "2010."     
## [11,] "2010."     
## [12,] "2008."     
## [13,] "2008."     
## [14,] "2008."
##The 15 publication 
q <- s%>% follow_link(css="#documents :nth-child(15) .col-lg-10 a") 
## Navigating to /catalog/b4764219
Title <-   html(q) %>%
  html_nodes("h3") %>%
  html_text()
Title 
## [1] "Ownership restructuring, political connections, and foreign portfolio investment in contemporary China"
if((length(Title) == 0) && (typeof(Title) == "character")) {Title <- NA}


Author <- html(q) %>%
  html_nodes(".blacklight-author_display a") %>%
  html_text()
Author
## [1] "Li, Weiye"
if((length(Author) == 0) && (typeof(Author) == "character")) {Author <- NA}


Subject <- html(q) %>%
  html_nodes("dd:nth-child(8) a") %>%
  html_text()
Subject
## [1] "Economics, General."
if((length(Subject) == 0) && (typeof(Subject) == "character")) {Subject <- NA}


Publish_Year <- html(q) %>%
  html_nodes(".title-subheading:nth-child(4)") %>%
  html_text()
Publish_Year
## [1] "2008."
if((length(Publish_Year) == 0) && (typeof(Publish_Year) == "character")) {Publish_Year <- NA}

Advisor <- html(q) %>%
  html_nodes("dd:nth-child(25)") %>%
  html_text()
Advisor
## character(0)
if((length(Advisor) == 0) && (typeof(Advisor) == "character")) {Advisor <- NA}

page3 <- cbind(Author = Author, Advisor = Advisor, Subject = Subject, Title = Title,  Publish_Year = Publish_Year )
page3
##      Author      Advisor Subject              
## [1,] "Li, Weiye" NA      "Economics, General."
##      Title                                                                                                   
## [1,] "Ownership restructuring, political connections, and foreign portfolio investment in contemporary China"
##      Publish_Year
## [1,] "2008."
data<- rbind(data,page3)
data
##       Author                       
##  [1,] "Feler, Leo"                 
##  [2,] "Chiang, Chun-Fang"          
##  [3,] "Kitagawa, Toru"             
##  [4,] "Gutierrez Fernandez, Emilio"
##  [5,] "Wilson, Nicholas L."        
##  [6,] "Michalopoulos, Stylianos G."
##  [7,] "Bennett, Daniel M."         
##  [8,] "Kunieda, Takuma"            
##  [9,] "Sekhri, Sheetal"            
## [10,] "Switala, André"             
## [11,] "Vargas, Carmiña O."         
## [12,] "Iliev, Peter"               
## [13,] "Ito, Yukiko"                
## [14,] "Camacho, Adriana"           
## [15,] "Li, Weiye"                  
##       Advisor                                        
##  [1,] "Advisor: J. Vernon Henderson."                
##  [2,] NA                                             
##  [3,] "Includes bibliographical references."         
##  [4,] NA                                             
##  [5,] NA                                             
##  [6,] NA                                             
##  [7,] NA                                             
##  [8,] "Thesis (Ph.D.)--Brown University, 2008."      
##  [9,] NA                                             
## [10,] "Vita."                                        
## [11,] "Chapter 1 co-written with André Switala."     
## [12,] "Thesis (Ph.D.)--Brown University, 2008."      
## [13,] NA                                             
## [14,] "\n                9780549674634\n            "
## [15,] NA                                             
##       Subject                                        
##  [1,] "Economic development > Brazil."               
##  [2,] "Economics, General."                          
##  [3,] "Instrumental variables (Statistics)"          
##  [4,] "Environmental policy > Developing countries." 
##  [5,] "History, United States."                      
##  [6,] "Geography."                                   
##  [7,] "Economics, General."                          
##  [8,] "Macroeconomics."                              
##  [9,] "Economics, General."                          
## [10,] "Child labor > Developing countries."          
## [11,] "Child labor > Developing countries."          
## [12,] "Economics."                                   
## [13,] "Economics, General."                          
## [14,] "Terrorism > Colombia > Psychological aspects."
## [15,] "Economics, General."                          
##       Title                                                                                                   
##  [1,] "Essays on banking and urban economic development"                                                      
##  [2,] "Politics, competition, and the media"                                                                  
##  [3,] "Three essays in instrumental variables"                                                                
##  [4,] "Voluntary compliance, pollution levels, and infant health"                                             
##  [5,] "Essays in applied microeconomics"                                                                      
##  [6,] "Essays on the historical determinants of comparative economic development"                             
##  [7,] "Externalities in global public health"                                                                 
##  [8,] "Macroeconomics for credit market imperfections and heterogeneous agents"                               
##  [9,] "Provision of natural and human resources in developing economies"                                      
## [10,] "Essays in the economics of education and child labor"                                                  
## [11,] "Three essays on child labor"                                                                           
## [12,] "Essays in economics and finance"                                                                       
## [13,] "Essays on multinational enterprises"                                                                   
## [14,] "Essays on the health reform and health outcomes in Colombia"                                           
## [15,] "Ownership restructuring, political connections, and foreign portfolio investment in contemporary China"
##       Publish_Year
##  [1,] "2010."     
##  [2,] "2008."     
##  [3,] "2009."     
##  [4,] "2009."     
##  [5,] "2008."     
##  [6,] "2008."     
##  [7,] "2008."     
##  [8,] "2008."     
##  [9,] "2008."     
## [10,] "2010."     
## [11,] "2010."     
## [12,] "2008."     
## [13,] "2008."     
## [14,] "2008."     
## [15,] "2008."
Brown_University = as.data.frame(data)
Brown_University
##                         Author
## 1                   Feler, Leo
## 2            Chiang, Chun-Fang
## 3               Kitagawa, Toru
## 4  Gutierrez Fernandez, Emilio
## 5          Wilson, Nicholas L.
## 6  Michalopoulos, Stylianos G.
## 7           Bennett, Daniel M.
## 8              Kunieda, Takuma
## 9              Sekhri, Sheetal
## 10              Switala, André
## 11          Vargas, Carmiña O.
## 12                Iliev, Peter
## 13                 Ito, Yukiko
## 14            Camacho, Adriana
## 15                   Li, Weiye
##                                          Advisor
## 1                  Advisor: J. Vernon Henderson.
## 2                                           <NA>
## 3           Includes bibliographical references.
## 4                                           <NA>
## 5                                           <NA>
## 6                                           <NA>
## 7                                           <NA>
## 8        Thesis (Ph.D.)--Brown University, 2008.
## 9                                           <NA>
## 10                                         Vita.
## 11      Chapter 1 co-written with André Switala.
## 12       Thesis (Ph.D.)--Brown University, 2008.
## 13                                          <NA>
## 14 \n                9780549674634\n            
## 15                                          <NA>
##                                          Subject
## 1                 Economic development > Brazil.
## 2                            Economics, General.
## 3            Instrumental variables (Statistics)
## 4   Environmental policy > Developing countries.
## 5                        History, United States.
## 6                                     Geography.
## 7                            Economics, General.
## 8                                Macroeconomics.
## 9                            Economics, General.
## 10           Child labor > Developing countries.
## 11           Child labor > Developing countries.
## 12                                    Economics.
## 13                           Economics, General.
## 14 Terrorism > Colombia > Psychological aspects.
## 15                           Economics, General.
##                                                                                                     Title
## 1                                                        Essays on banking and urban economic development
## 2                                                                    Politics, competition, and the media
## 3                                                                  Three essays in instrumental variables
## 4                                               Voluntary compliance, pollution levels, and infant health
## 5                                                                        Essays in applied microeconomics
## 6                               Essays on the historical determinants of comparative economic development
## 7                                                                   Externalities in global public health
## 8                                 Macroeconomics for credit market imperfections and heterogeneous agents
## 9                                        Provision of natural and human resources in developing economies
## 10                                                   Essays in the economics of education and child labor
## 11                                                                            Three essays on child labor
## 12                                                                        Essays in economics and finance
## 13                                                                    Essays on multinational enterprises
## 14                                            Essays on the health reform and health outcomes in Colombia
## 15 Ownership restructuring, political connections, and foreign portfolio investment in contemporary China
##    Publish_Year
## 1         2010.
## 2         2008.
## 3         2009.
## 4         2009.
## 5         2008.
## 6         2008.
## 7         2008.
## 8         2008.
## 9         2008.
## 10        2010.
## 11        2010.
## 12        2008.
## 13        2008.
## 14        2008.
## 15        2008.
write.csv(Brown_University,  file= "Brown_University.csv") 



#2. Caltech

#caltech_link <- html("http://thesis.library.caltech.edu/view/degree/phd/")