Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
removed richtations, makred defunct
Browse files Browse the repository at this point in the history
bumpd dev version
removed a donttest to just commenting out the eg
  • Loading branch information
sckott committed Feb 28, 2017
1 parent aa345c8 commit 145d7ef
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 254 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description: A programmatic interface to the 'SOLR' based
articles, making plots, doing 'faceted' searches,
'highlight' searches, and viewing results of 'highlighted'
searches in a browser.
Version: 0.6.7.9200
Version: 0.6.7.9910
License: MIT + file LICENSE
Authors@R: c(
person("Scott", "Chamberlain", role = c("aut", "cre"), email = "[email protected]"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ rplos 0.4.7

### NEW FEATURES

* New function `citations()` for querying the [PLOS Rich Citations API](http://api.richcitations.org/) (#88)
* New function `citations()` for querying the PLOS Rich Citations API (http://api.richcitations.org/) (#88)

### BUG FIXES

Expand Down
54 changes: 5 additions & 49 deletions R/citations.R
Original file line number Diff line number Diff line change
@@ -1,51 +1,7 @@
#' Search PLOS Rich Citations API
#'
#' This function is defunct.
#' @export
#' @param uri (character) A URI, of the form \code{http://dx.doi.org/<DOI>}
#' @param doi (character) A PLOS journals DOI
#' @param parse (logical) Passed to \code{\link[jsonlite]{fromJSON}}, toggles
#' whether we return json parsed to data.frame's where possible, or not.
#' Default: FALSE
#' @param ... Curl options passed to \code{\link[httr]{GET}}
#' @return A list
#' @references \url{http://api.richcitations.org/}
#' @details To get an API key, email \email{ploslabs@@plos.org} and request a key
#' @examples \dontrun{
#' # get citations for an article (via its DOI)
#' # uri <- "http://dx.doi.org/10.1371%2Fjournal.pone.0000000"
#' # citations(uri)
#' # citations(uri, parse = TRUE)
#'
#' # pass in a DOI, url encoded or not
#' # citations(doi = "10.1371%2Fjournal.pone.0000000")
#' # citations(doi = "10.1371/journal.pone.0000000")
#' # ids <- searchplos(q='ecology', fl='id', limit = 20)$data$id
#' # citations(doi = ids[1])
#' }

citations <- function(uri = NULL, doi = NULL, parse = FALSE, ...) {
calls <- names(sapply(match.call(), deparse))[-1]
if ("random" %in% calls) stop("The parameter 'random' has been removed", call. = FALSE)

# one has to be non-NULL
stopifnot(length(ploscompact(list(uri, doi))) == 1)
uri <- uriparse(uri, doi)
args <- ploscompact(list(uri = uri))
if (length(args) == 0) args <- NULL
res <- GET(richbase(), query = args, ...)
stop_for_status(res)
jsonlite::fromJSON(utf8cont(res), parse)
}

richbase <- function() "http://api.richcitations.org/papers"

uriparse <- function(x, y) {
# both can't be null
stopifnot(xor(!is.null(x), !is.null(y)))
# check for url encoding
if (!is.null(y)) {
paste0("http://dx.doi.org/", sub("/", "%2F", y))
} else {
x
}
#' @rdname citations-defunct
#' @keywords internal
citations <- function(...) {
.Defunct(msg = "the data provider behind citations() is gone")
}
6 changes: 2 additions & 4 deletions R/highplos.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
#' highplos(q='alcohol', hl.fl='abstract', hl.snippets=5, hl.mergeContiguous='true', rows=5)
#' highplos(q='alcohol', hl.fl='abstract', hl.useFastVectorHighlighter='true', rows=5)
#' highplos(q='everything:"experiment"', fq='doc_type:full', rows=100, hl.fl = 'title')
#' }
#'
#' @examples \donttest{
#' highplos(q='alcohol', hl.fl = 'abstract', rows=1200)
#'
#' # highplos(q='alcohol', hl.fl = 'abstract', rows=1200)
#' }

highplos <- function(q, fl=NULL, fq=NULL, hl.fl = NULL, hl.snippets = NULL, hl.fragsize = NULL,
Expand Down
1 change: 0 additions & 1 deletion R/plosabstract.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' plosabstract(q = 'drosophila', fl=c('id','author'), limit = 5)
#' plosabstract(q = 'drosophila', fl='author', limit = 5)
#' plosabstract(q = 'drosophila', fl=c('id','author','title'), limit = 5)
#' plosabstract(q = 'drosophila', fl=c('id','author','title'), limit = 5, config=verbose())
#' }

plosabstract <- function(q = NULL, fl = 'id', fq = NULL, sort = NULL, start = 0,
Expand Down
1 change: 1 addition & 0 deletions R/rplos-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ NULL
#' \itemize{
#' \item \code{\link{crossref}}: service no longer provided -
#' see the package \code{rcrossref}
#' \item \code{\link{citations}}: service no longer available
#' }
#'
#' @name rplos-defunct
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ rplos tutorial at rOpenSci website [here](http://ropensci.org/tutorials/rplos_tu

PLoS API documentation [here](http://api.plos.org/)

Crossref API documentation [here](https://github.com/CrossRef/rest-api-doc/blob/master/rest_api.md), [here](http://crosstech.crossref.org/2014/04/%E2%99%AB-researchers-just-wanna-have-funds-%E2%99%AB.html), and [here](http://help.crossref.org/#home). Note that we are working on a new package [rcrossref](https://github.com/ropensci/rcrossref) ([on CRAN](https://cran.r-project.org/package=rcrossref)) with a much fuller implementation of R functions for all Crossref endpoints.
Crossref API documentation [here](https://github.com/CrossRef/rest-api-doc/blob/master/rest_api.md), and [here](http://help.crossref.org/#home). Note that we are working on a new package [rcrossref](https://github.com/ropensci/rcrossref) ([on CRAN](https://cran.r-project.org/package=rcrossref)) with a much fuller implementation of R functions for all Crossref endpoints.

## Quick start

Expand Down
Loading

0 comments on commit 145d7ef

Please sign in to comment.