massimoaria / pubmedR

Gathering metadata about publications, patents, grants, clinical trials and policy documents from PubMed database
Other
36 stars 13 forks source link

Cannot reproduce the example. #5

Closed hh1985 closed 4 years ago

hh1985 commented 4 years ago

The code M <- pmApi2df(D) gave the following warnings:

Warning messages:
1: In min(as.numeric(a[ind]), na.rm = TRUE) :
  no non-missing arguments to min; returning Inf
2: In min(as.numeric(a[ind]), na.rm = TRUE) :
  no non-missing arguments to min; returning Inf

And code M <- convert2df(M, dbsource = "pubmed", format = "api") reported error message:

Converting your pubmed collection into a bibliographic dataframe

Error in data.frame(AU = rep(NA, n), AF = "NA", TI = "NA", SO = "NA",  :
  arguments imply differing number of rows: 0, 1

-Han

massimoaria commented 4 years ago

Please, upload your full script, including the query.

hh1985 commented 4 years ago

@massimoaria I attached the script.

> library(pubmedR)
> 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

To start with the shiny web-interface, please digit:
biblioshiny()

> api_key <- NULL
> query <- "bibliometric*[Title/Abstract] AND english[LA] AND Journal Article[PT] AND 2000:2020[DP]"
> res <- pmQueryTotalCount(query = query, api_key = api_key)
> D <- pmApiRequest(query = query, limit = res$total_count, api_key = api_key)
Documents  200  of  3195 
Documents  400  of  3195 
Documents  600  of  3195 
Documents  800  of  3195 
Documents  1000  of  3195 
Documents  1200  of  3195 
Documents  1400  of  3195 
Documents  1600  of  3195 
Documents  1800  of  3195 
Documents  2000  of  3195 
Documents  2200  of  3195 
Documents  2400  of  3195 
Documents  2600  of  3195 
Documents  2800  of  3195 
Documents  3000  of  3195 
Documents  3195  of  3195 
> M <- pmApi2df(D)
======================================================================================================================
Warning messages:
1: In min(as.numeric(a[ind]), na.rm = TRUE) :
  no non-missing arguments to min; returning Inf
2: In min(as.numeric(a[ind]), na.rm = TRUE) :
  no non-missing arguments to min; returning Inf
> M <- convert2df(M, dbsource = "pubmed", format = "api")

Converting your pubmed collection into a bibliographic dataframe

Error in data.frame(AU = rep(NA, n), AF = "NA", TI = "NA", SO = "NA",  : 
  arguments imply differing number of rows: 0, 1
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] bibliometrix_3.0.2 pubmedR_0.0.2     

loaded via a namespace (and not attached):
 [1] viridis_0.5.1        httr_1.4.1.9000      tidyr_1.0.0          tidygraph_1.1.2      jsonlite_1.6        
 [6] viridisLite_0.3.0    ggraph_2.0.0         shiny_1.4.0          assertthat_0.2.1     cellranger_1.1.0    
[11] ggrepel_0.8.1        rscopus_0.6.6        factoextra_1.0.7     pillar_1.4.2         backports_1.1.5     
[16] lattice_0.20-38      glue_1.3.1           digest_0.6.25        RColorBrewer_1.1-2   promises_1.1.0      
[21] polyclip_1.10-0      colorspace_1.4-1     plyr_1.8.4           shinycssloaders_0.3  htmltools_0.4.0     
[26] httpuv_1.5.2         Matrix_1.2-18        FactoMineR_2.3       XML_3.98-1.20        pkgconfig_2.0.3     
[31] haven_2.2.0          purrr_0.3.3          xtable_1.8-4         scales_1.1.0         stringdist_0.9.5.5  
[36] tweenr_1.0.1         openxlsx_4.1.4       later_1.0.0          rio_0.5.16           ggforce_0.3.1       
[41] tibble_2.1.3         farver_2.0.1         ggplot2_3.2.1        DT_0.10              lazyeval_0.2.2      
[46] readxl_1.3.1         magrittr_1.5         crayon_1.3.4         mime_0.7             SnowballC_0.7.0     
[51] MASS_7.3-51.5        forcats_0.4.0        foreign_0.8-75       tools_3.6.3          data.table_1.12.6   
[56] hms_0.5.2            lifecycle_0.1.0      stringr_1.4.0        munsell_0.5.0        zip_2.0.4           
[61] cluster_2.1.0        packrat_0.5.0        networkD3_0.4        flashClust_1.01-2    compiler_3.6.3      
[66] rlang_0.4.2          grid_3.6.3           rstudioapi_0.10      htmlwidgets_1.5.1    leaps_3.0           
[71] igraph_1.2.5         gtable_0.3.0         rentrez_1.2.2        curl_4.3             graphlayouts_0.5.0  
[76] R6_2.4.1             gridExtra_2.3        dplyr_0.8.3          fastmap_1.0.1        zeallot_0.1.0       
[81] shinythemes_1.1.2    stringi_1.4.3        parallel_3.6.3       Rcpp_1.0.3           vctrs_0.2.0         
[86] dimensionsR_0.0.1    scatterplot3d_0.3-41 tidyselect_0.2.5

pubmed_r_example.R.zip

massimoaria commented 4 years ago

There was a typo in the last code line of the example: The right code is: M <- convert2df(D, dbsource = "pubmed", format = "api")

I have just corrected the readme file on github