dami82 / easyPubMed

easyPubMed package for R - dev version
21 stars 8 forks source link

class(my_abstracts_xml) return character #1

Closed leeningzzu closed 5 years ago

leeningzzu commented 5 years ago

hi when I try the codes of "Retrieving and Processing PubMed Records using easyPubMed": >my_abstracts_xml <- fetch_pubmed_data(my_entrez_id)

class(my_abstracts_xml) [1] "character" this just return character ,I want to know how to fix it? Thanks! This package is amazing 😝

sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 [2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 [4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

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

other attached packages: [1] XML_3.98-1.19 kableExtra_1.0.1 [3] dplyr_0.7.8 easyPubMed_2.12

loaded via a namespace (and not attached): [1] Rcpp_1.0.0 pillar_1.3.1
[3] compiler_3.5.2 bindr_0.1.1
[5] tools_3.5.2 digest_0.6.18
[7] evaluate_0.12 tibble_2.0.1
[9] viridisLite_0.3.0 pkgconfig_2.0.2
[11] rlang_0.3.1 rstudioapi_0.9.0 [13] yaml_2.2.0 xfun_0.4
[15] bindrcpp_0.2.2 httr_1.4.0
[17] stringr_1.4.0 knitr_1.21
[19] xml2_1.2.0 hms_0.4.2
[21] webshot_0.5.1 tidyselect_0.2.5 [23] glue_1.3.0 R6_2.3.0
[25] rmarkdown_1.11 pacman_0.5.0
[27] readr_1.3.1 purrr_0.3.0
[29] magrittr_1.5 scales_1.0.0
[31] htmltools_0.3.6 assertthat_0.2.0 [33] rvest_0.3.2 colorspace_1.4-0 [35] stringi_1.2.4 munsell_0.5.0
[37] crayon_1.3.4

dami82 commented 5 years ago

Since version 2.11, easyPubMed does not use the XML library for processing PubMed records anymore. Therefore, functions such as fetch_pubmed_data() and others return character-class objects (strings which include XML tags) instead of XMLInternalDocument-class objects. This is clearly stated in the vignette that comes with the package (try: vignette("getting_started_with_easyPubMed")). If you absolutely need to get an XMLInternalDocument object, you can roll back to version 2.9 (available here, on GitHub, aka "dev version of the package"), or you can use XML or a similar library to cast the XML string returned by fetch_pubmed_data().