Comments (3)
Full local function to fix this error @(mgclaros)
predict_h_index <- function(id, journals = NULL) {
id <- tidy_id(id)
# Getting the h-index and checking for NA
h <- get_profile(id)$h_index
if (is.na(h)) return(NA)
n <- get_num_articles(id) # number of articles written
y <- as.numeric(format(Sys.Date(), "%Y")) - get_oldest_article(id)
j <- get_num_distinct_journals(id)
# Handle optional journals parameter
if (is.null(journals)) {
q <- get_num_top_journals(id)
} else {
q <- get_num_top_journals(id, journals)
}
# Regression coefficients
coefs <- c(
1, 0.760, 0.373, 0.967, -0.069, 0.018, 0.033,
2, 1.413, 0.781, 0.936, -0.132, 0.018, 0.064,
3, 2.227, 1.105, 0.903, -0.193, 0.027, 0.096,
4, 3.196, 1.386, 0.871, -0.274, 0.039, 0.145,
5, 3.997, 1.578, 0.858, -0.345, 0.063, 0.198,
6, 4.752, 1.671, 0.817, -0.377, 0.117, 0.282,
7, 5.741, 1.761, 0.761, -0.420, 0.170, 0.394,
8, 6.531, 1.796, 0.669, -0.420, 0.252, 0.508,
9, 7.482, 1.653, 0.561, -0.415, 0.383, 0.629,
10, 8.734, 1.326, 0.478, -0.411, 0.522, 0.823
)
coefs.m <- matrix(coefs, nrow=10, byrow=TRUE)
coefs <- coefs.m[,-1]
vals <- c(1, sqrt(n), h, y, j, q)
# Calculate the h-index predictions
h.pred <- coefs %*% vals
h.vals <- c(h, h.pred)
# Check for sensible values
standard.warning <- "You're probably not a neuroscientist. Please read the documentation for information on the limitations of this function."
if (any(diff(h.vals) < 0)) {
warning(paste0("Decreasing h-values predicted. ", standard.warning))
}
if (any(h.vals < 0)) {
warning(paste0("Negative h-values predicted. ", standard.warning))
}
return(data.frame(years_ahead = 0:10, h_index = h.vals))
}
from scholar.
Installing the development version solves the error like
remotes::install_github("jkeirstead/scholar")
from scholar.
The development version did not function, but the 'alternative' the function worked fine :-) Thanks!
from scholar.
Related Issues (20)
- Years with zero citations cause get_article_cite_history() to fail HOT 3
- get_publications() returns NA for all pubids HOT 2
- author_position() typos in calculation for `Position_Normalized`
- get_publications() `pubid` outputs all `<NA>` HOT 1
- Getting full article citation information (not only the summary)
- get_publication 404 errors HOT 1
- Get scholar does not work for ids with punctuation
- Add new function to create .bib bibliography file for later processing HOT 6
- fix to get_scholar_id HOT 1
- Fix for duplicate profiles HOT 1
- Unclear documentation for swap_initials() within the format_publications function. HOT 1
- Error in predict_h_index() HOT 1
- get_complete_authors returns NA HOT 1
- predict.r
- get_coauthors limited to 20 coauthors HOT 1
- add function get_pubs_all_authors - submission HOT 1
- Retrieving field-of-interest/expertise labels HOT 3
- get_publications(id) is not returning pubid HOT 3
- get_article_cite_history(id, pubid) sometimes is not returning HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scholar.