Giter VIP home page Giter VIP logo

Comments (6)

jkeirstead avatar jkeirstead commented on July 18, 2024

Very strange. I get the expected output on my machine with the environment below.

Maybe it's an issue with XML? Could you run the following code and attach the output?

id <- '0ryVFl8AAAAJ'
url_template <- "http://scholar.google.com/citations?hl=en&user=%s"
url <- sprintf(url_template, id)

## Generate a list of all the tables identified by the scholar ID
library(XML)
tables <- readHTMLTable(url)
stats <- tables$stats
stats
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

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

other attached packages:
 [1] devtools_1.3.99  scholar_0.1.0    arm_1.5-08       foreign_0.8-51  
 [5] abind_1.4-0      R2WinBUGS_2.1-18 coda_0.16-1      lme4_0.999999-0 
 [9] Matrix_1.0-9     lattice_0.20-10  MASS_7.3-22      ggplot2_0.9.3   
[13] reshape2_1.2.2   plyr_1.8        

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   dichromat_2.0-0    digest_0.6.3       evaluate_0.5.1    
 [5] grid_2.15.2        gtable_0.1.2       httr_0.2           labeling_0.2      
 [9] memoise_0.1        munsell_0.4.2      nlme_3.1-108       parallel_2.15.2   
[13] proto_0.3-10       R.cache_0.9.0      R.methodsS3_1.5.2  R.oo_1.15.8       
[17] R.utils_1.27.1     RColorBrewer_1.0-5 RCurl_1.95-4.1     scales_0.2.3      
[21] stats4_2.15.2      stringr_0.6.2      tools_2.15.2       whisker_0.3-2     
[25] XML_3.98-1.1

from scholar.

chrisamiller avatar chrisamiller commented on July 18, 2024

Sure - here's the output:

> library(scholar)
> id <- '0ryVFl8AAAAJ'
> url_template <- "http://scholar.google.com/citations?hl=en&user=%s"
> url <- sprintf(url_template, id)
> library(XML)
> tables <- readHTMLTable(url)
> stats <- tables$stats
> stats
         V1   V2         V3
1            All Since 2008
2 Citations 1257       1251
3   h-index   11         11
4 i10-index   12         12

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.utf8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.utf8        LC_COLLATE=C             
 [5] LC_MONETARY=en_US.utf8    LC_MESSAGES=en_US.utf8   
 [7] LC_PAPER=C                LC_NAME=C                
 [9] LC_ADDRESS=C              LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C      

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

other attached packages:
[1] XML_3.2-0     scholar_0.1.0

loaded via a namespace (and not attached):
[1] R.cache_0.9.0     R.methodsS3_1.5.2 R.oo_1.15.8       R.utils_1.27.1   
[5] plyr_1.8          stringr_0.4 

FWIW, confirming that get_profile still has the issue in this new session:

> get_profile('0ryVFl8AAAAJ')
$id
[1] "0ryVFl8AAAAJ"

$name
[1] "Chris Miller"

$affiliation
[1] "The Genome Institute at Washington University"

$total_cites
[1] NA

$h_index
[1] 1257

$i10_index
[1] 11

$fields
[1] "cancer genomics"       "computational biology" "systems biology"      

$homepage
[1] "http://www.chrisamiller.com/"

Warning message:
In get_profile("0ryVFl8AAAAJ") : NAs introduced by coercion

from scholar.

jkeirstead avatar jkeirstead commented on July 18, 2024

Hmm. As you can see in the code those fields are populated directly from that table, so if the table's parsing correctly, I'm not sure why the individual values would be wrong.

You're not the only person to report this issue so hopefully with a few more reports we can see what's going on. In the meantime, you might be able to isolate the problem by stepping through the get_profile function source code.

Apologies and hope to get it sorted quickly.

from scholar.

jkeirstead avatar jkeirstead commented on July 18, 2024

Ahhh... I think I know what the problem is. The stats table on my machine only has three rows, possibly because of text encoding issues. I've just pushed a fix so if you reinstall from Github, it should now be working.

from scholar.

chrisamiller avatar chrisamiller commented on July 18, 2024

Yep - that seems to have done it. Thanks for pushing a fix, and nice little package!

from scholar.

jkeirstead avatar jkeirstead commented on July 18, 2024

Glad that did the trick!

from scholar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.