Skip to content

Commit

Permalink
Added pagesize argument to compare_scholars.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeirstead committed Feb 13, 2015
1 parent 288a2a5 commit cfe069b
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by roxygen2 (4.0.1): do not edit by hand
# Generated by roxygen2 (4.1.0): do not edit by hand

export(compare_scholar_careers)
export(compare_scholars)
Expand Down
6 changes: 4 additions & 2 deletions R/compare.r
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ utils::globalVariables(c("year", "cites"))
##' the scholar's publications by year of publication.
##'
##' @param ids a vector of Google Scholar IDs
##' @param pagesize an integer specifying the number of articles to
##' fetch for each scholar
##' @return a data frame giving the ID of each scholar and the total
##' number of citations received by work published in a year.
##' @examples {
Expand All @@ -19,10 +21,10 @@ utils::globalVariables(c("year", "cites"))
##' }
##' @export
##' @import plyr
compare_scholars <- function(ids) {
compare_scholars <- function(ids, pagesize=100) {

## Load in the publication data and summarize
data <- lapply(ids, function(x) return(cbind(id=x, get_publications(x))))
data <- lapply(ids, function(x) return(cbind(id=x, get_publications(x, pagesize=pagesize))))
data <- ldply(data)
data <- ddply(data, .(id, year), summarize, cites=sum(cites, na.rm=TRUE))
data <- ddply(data, .(id), transform, total=cumsum(cites))
Expand Down
3 changes: 2 additions & 1 deletion man/compare_scholar_careers.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/compare.r
\name{compare_scholar_careers}
\alias{compare_scholar_careers}
\title{Compare the careers of multiple scholars}
Expand Down
8 changes: 6 additions & 2 deletions man/compare_scholars.Rd
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/compare.r
\name{compare_scholars}
\alias{compare_scholars}
\title{Compare the citation records of multiple scholars}
\usage{
compare_scholars(ids)
compare_scholars(ids, pagesize = 100)
}
\arguments{
\item{ids}{a vector of Google Scholar IDs}

\item{pagesize}{an integer specifying the number of articles to
fetch for each scholar}
}
\value{
a data frame giving the ID of each scholar and the total
Expand Down
3 changes: 2 additions & 1 deletion man/get_citation_history.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/scholar.r
\name{get_citation_history}
\alias{get_citation_history}
\title{Get historical citation data for a scholar}
Expand Down
3 changes: 2 additions & 1 deletion man/get_num_articles.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/publications.r
\name{get_num_articles}
\alias{get_num_articles}
\title{Calculates how many articles a scholar has published}
Expand Down
3 changes: 2 additions & 1 deletion man/get_num_distinct_journals.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/scholar.r
\name{get_num_distinct_journals}
\alias{get_num_distinct_journals}
\title{Gets the number of distinct journals in which a scholar has
Expand Down
3 changes: 2 additions & 1 deletion man/get_num_top_journals.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/scholar.r
\name{get_num_top_journals}
\alias{get_num_top_journals}
\title{Gets the number of top journals in which a scholar has published}
Expand Down
3 changes: 2 additions & 1 deletion man/get_oldest_article.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/publications.r
\name{get_oldest_article}
\alias{get_oldest_article}
\title{Gets the year of the oldest article for a scholar}
Expand Down
3 changes: 2 additions & 1 deletion man/get_profile.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/scholar.r
\name{get_profile}
\alias{get_profile}
\title{Gets profile information for a scholar}
Expand Down
3 changes: 2 additions & 1 deletion man/get_publications.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/publications.r
\name{get_publications}
\alias{get_publications}
\title{Gets the publications for a scholar}
Expand Down
3 changes: 2 additions & 1 deletion man/predict_h_index.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/predict.r
\name{predict_h_index}
\alias{predict_h_index}
\title{Predicts the h-index for a researcher}
Expand Down
3 changes: 2 additions & 1 deletion man/scholar.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/scholar-package.r
\docType{package}
\name{scholar}
\alias{scholar}
Expand Down
3 changes: 2 additions & 1 deletion man/tidy_id.Rd
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/scholar-package.r
\name{tidy_id}
\alias{tidy_id}
\title{Ensures that specified IDs are correctly formatted}
Expand Down

0 comments on commit cfe069b

Please sign in to comment.