#install.packages("dplyr", "factoextra", "FactoMineR", "ggplot2", "igraph", "Matrix", "rscopus", "SnowballC", "stringr")
#install.packages("stringi")
#install.packages("bibliometrix", dependencies=TRUE)

library(bibliometrix)
## To cite bibliometrix in publications, please use:
## 
## Aria, M. & Cuccurullo, C. (2017) bibliometrix: An R-tool for comprehensive science mapping analysis, Journal of Informetrics, 11(4), pp 959-975, Elsevier.
## 
## http:\\www.bibliometrix.org
library(RISmed)

search_topic <-"(refugee*[ti] AND review [pt])"
search_query <- EUtilsSummary(search_topic) 
summary(search_query) 
## Query:
## (refugee[ti] OR refugee'[ti] OR refugee's[ti] OR refugeeism[ti] OR refugeeness[ti] OR refugees[ti] OR refugees'[ti]) AND review[pt] 
## 
## Result count:  289
D <- EUtilsGet(search_query)

M <- pubmed2df(D)
## 
## Downloading updated citations from PubMed/MedLine...
results <- biblioAnalysis(M, sep = ";")

options(width=100)
S <- summary(object = results, k = 10, pause = FALSE)
## 
## 
## Main Information about data
## 
##  Documents                             282 
##  Sources (Journals, Books, etc.)       182 
##  Keywords Plus (ID)                    694 
##  Author's Keywords (DE)                694 
##  Period                                1983 - 2018 
##  Average citations per documents       6.564 
## 
##  Authors                               842 
##  Author Appearances                    931 
##  Authors of single authored documents  56 
##  Authors of multi authored documents   786 
## 
##  Documents per Author                  0.335 
##  Authors per Document                  2.99 
##  Co-Authors per Documents              3.3 
##  Collaboration Index                   3.64 
##  
## 
## Annual Scientific Production
## 
##  Year    Articles
##     1983        2
##     1984        2
##     1988        2
##     1989        3
##     1990        2
##     1991        2
##     1992        6
##     1994        2
##     1995        7
##     1996        5
##     1997        6
##     1998        5
##     1999       10
##     2000        3
##     2001        5
##     2002        7
##     2003        7
##     2004        8
##     2005        8
##     2006        7
##     2007        6
##     2008        8
##     2009        7
##     2010       13
##     2011        7
##     2012        7
##     2013        7
##     2014       12
##     2015       20
##     2016       32
##     2017       45
##     2018       19
## 
## Annual Percentage Growth Rate 7.532433 
## 
## 
## Most Productive Authors
## 
##    Authors        Articles Authors        Articles Fractionalized
## 1    SILOVE D            6  SILOVE D                         3.58
## 2    MONTGOMERY E        4  MUECKE MA                        3.00
## 3    POTTIE K            4  MONTGOMERY E                     2.08
## 4    PRIEBE S            4  WILLIAMS N                       2.00
## 5    BENSON J            3  BENSON J                         1.50
## 6    CARLSSON J          3  PALINKAS LA                      1.50
## 7    CHENG IH            3  PICKWELL SM                      1.50
## 8    FAZEL M             3  SCHWEITZER RD                    1.33
## 9    GREENAWAY C         3  BEISER M                         1.20
## 10   MUECKE MA           3  PROCTER N                        1.20
## 
## 
## Top manuscripts per citations
## 
##                                                                                                             Paper         
## 1  FAZEL M;WHEELER J;DANESH J,(2005),LANCET                                                                               
## 2  HOLLIFIELD M;WARNER TD;LIAN N;KRAKOW B;JENKINS JH;KESLER J;STEVENSON J;WESTERMEYER J,(2002),JAMA                       
## 3  KIRMAYER LJ;NARASIAH L;MUNOZ M;RASHID M;RYDER AG;GUZDER J;HASSAN G;ROUSSEAU C;POTTIE K,(2010),CMAJ                     
## 4  LINDERT J;EHRENSTEIN OS;PRIEBE S;MIELCK A;BRÄHLER E,(2009),SOC SCI MED                                                 
## 5  TOOLE MJ;WALDMAN RJ,(1997),ANNU REV PUBLIC HEALTH                                                                      
## 6  FAZEL M;REED RV;PANTER-BRICK C;STEIN A,(2011),LANCET                                                                   
## 7  BEISER M,(2005),CAN J PUBLIC HEALTH                                                                                    
## 8  LUSTIG SL;KIA-KEATING M;KNIGHT WG;GELTMAN P;ELLIS H;KINZIE JD;KEANE T;SAXE GN,(2003),J AM ACAD CHILD ADOLESC PSYCHIATRY
## 9  ROSSI C;SHRIER I;MARSHALL L;CNOSSEN S;SCHWARTZMAN K;KLEIN MB;SCHWARZER G;GREENAWAY C,(2012),PLOS ONE                   
## 10 NICKERSON A;BRYANT RA;SILOVE D;STEEL Z,(2010),CLIN PSYCHOL REV                                                         
##     TC TCperYear
## 1  195     15.00
## 2   75      4.69
## 3   68      8.50
## 4   59      6.56
## 5   52      2.48
## 6   48      6.86
## 7   46      3.54
## 8   44      2.93
## 9   36      6.00
## 10  36      4.50
## 
## 
## Most Productive Countries (of corresponding authors)
## 
##      Country   Articles   Freq SCP MCP
## 1  USA               65 0.3571  61   4
## 2  AUSTRALIA         39 0.2143  29  10
## 3  CANADA            16 0.0879  15   1
## 4  DENMARK            9 0.0495   9   0
## 5  NETHERLANDS        8 0.0440   6   2
## 6  GERMANY            7 0.0385   6   1
## 7  GREECE             5 0.0275   3   2
## 8  SWITZERLAND        4 0.0220   2   2
## 9  ENGLAND            3 0.0165   2   1
## 10 SWEDEN             3 0.0165   3   0
## 
## 
## SCP: Single Country Publications
## 
## MCP: Multiple Country Publications
## 
## 
## Total Citations per Country
## 
##      Country      Total Citations Average Article Citations
## 1  USA                        353                     5.431
## 2  AUSTRALIA                  205                     5.256
## 3  CANADA                     135                     8.438
## 4  GERMANY                     76                    10.857
## 5  MEXICO                      75                    75.000
## 6  DENMARK                     37                     4.111
## 7  NETHERLANDS                 28                     3.500
## 8  IRELAND                     23                    23.000
## 9  ENGLAND                     18                     6.000
## 10 GEORGIA                     13                    13.000
## 
## 
## Most Relevant Sources
## 
##                       Sources        Articles
## 1  J IMMIGR MINOR HEALTH                   12
## 2  SOC SCI MED                              8
## 3  TRANSCULT PSYCHIATRY                     7
## 4  CHILD ADOLESC PSYCHIATR CLIN N AM        6
## 5  LANCET                                   5
## 6  CMAJ                                     4
## 7  INT J ENVIRON RES PUBLIC HEALTH          4
## 8  NERVENARZT                               4
## 9  AM FAM PHYSICIAN                         3
## 10 AUST FAM PHYSICIAN                       3
## 
## 
## Most Relevant Keywords
## 
##    Author Keywords (DE)      Articles Keywords-Plus (ID)     Articles
## 1          PSYCHOLOGY             246      PSYCHOLOGY             246
## 2          REFUGEES               245      REFUGEES               245
## 3          HUMANS                 243      HUMANS                 243
## 4          EPIDEMIOLOGY           124      EPIDEMIOLOGY           124
## 5          ETHNOLOGY               97      ETHNOLOGY               97
## 6          NUMERICAL DATA          97      NUMERICAL DATA          97
## 7          STATISTICS &AMP         97      STATISTICS &AMP         97
## 8          ADMINISTRATION          90      ADMINISTRATION          90
## 9          ORGANIZATION &AMP       90      ORGANIZATION &AMP       90
## 10         CHILD                   63      CHILD                   63
plot(x = results, k = 10, pause = FALSE)

# Alternativa

freq_artigos = data.frame(table(M$PY))
summary(freq_artigos)
##       Var1         Freq       
##  1983   : 1   Min.   : 2.000  
##  1984   : 1   1st Qu.: 4.500  
##  1988   : 1   Median : 7.000  
##  1989   : 1   Mean   : 8.812  
##  1990   : 1   3rd Qu.: 8.000  
##  1991   : 1   Max.   :45.000  
##  (Other):26
barplot(freq_artigos$Freq, beside = T, ylab = "# of publications", col = "black", las = 2, names.arg = freq_artigos$Var1, density = 0, ylim=c(0,50))

plot(freq_artigos$Freq, t="l")