Cannot Extract the Citation and Index information in R with the 'scholar'

Hello I want to extract the citation, h-index and i10-index from Google Scholar in R with the package 'scholar' but it returns an error. Can you help me fix it? I really appreciate it.

library(scholar)

professors <- data.frame(
  name = c("John Smith", "Jane Doe", "Mike Johnson"),
  school = c("Harvard University", "Stanford University", "MIT")
)

get_citation_info <- function(name, school) {
  query <- paste(name, school, sep = " ")
  result <- scholar(query, pages = 1)
  citation <- result$metrics$citations
  index <- result$metrics$hindex
  return(data.frame(name = name, school = school, citation = citation, index = index))
}

citation_info <- mapply(get_citation_info, professors$name, professors$school, SIMPLIFY = FALSE)
citation_info <- do.call(rbind, citation_info)

Screenshot 2023-03-14 at 17.30.33

The error indicates that a function is not in namespace, which it should be following library(scholar) leading to looking at ??scholar and finding that no such function is listed. Did you mean to use

library(scholar)
get_scholar_id(first_name = "michael", last_name = "sander", affiliation = "Mines")
#> [1] "PZpkMDUAAAAJ"

Created on 2023-03-14 with reprex v2.0.2

Thanks for your reply. I have a list of professors' names and I want to have their citation and index based on their names. Do you have any other suggestions?

Yes, use the form of the example—first,last,affiliation. If you have more than a handful, make each a vector, put those in a list and use lapply.

Thanks for your suggestions and I'll try it. Really appreciate it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.