diff --git a/DESCRIPTION b/DESCRIPTION index beb2dbc..44abbdd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -5,7 +5,7 @@ Description: Client for various 'CrossRef' APIs, including 'metadata' search (including 'bibtex', 'citeproc-json', 'rdf-xml', etc.), convert 'DOIs' to 'PMIDs', and 'vice versa', get citations for 'DOIs', and get links to full text of articles when available. -Version: 0.5.8.9400 +Version: 0.5.9.9100 License: MIT + file LICENSE Authors@R: c( person("Scott", "Chamberlain", role = c("aut", "cre"), email = "myrmecocystus@gmail.com"), diff --git a/R/cr_cn.r b/R/cr_cn.r index 4591698..c954a7c 100644 --- a/R/cr_cn.r +++ b/R/cr_cn.r @@ -14,8 +14,8 @@ #' @param raw (logical) Return raw text in the format given by \code{format} #' parameter. Default: FALSE #' @template moreargs -#' @details See \url{http://www.crosscite.org/cn/} for more info on the Crossref -#' Content Negotiation API service. +#' @details See \url{http://citation.crosscite.org/docs.html} for more info +#' on the Crossref Content Negotiation API service. #' #' DataCite DOIs: Some values of the \code{format} parameter won't work with #' DataCite DOIs, i.e. "citeproc-json", "crossref-xml", "crossref-tdm", diff --git a/R/cr_fundref.r b/R/cr_fundref.r index 952bb1c..d8f0738 100644 --- a/R/cr_fundref.r +++ b/R/cr_fundref.r @@ -63,14 +63,10 @@ #' cr_funders_('10.13039/100000001', works = TRUE, cursor = "*", #' cursor_max = 300, limit = 100, parse = TRUE) #' } -`cr_fundref` <- function(dois = NULL, query = NULL, filter = NULL, offset = NULL, +`cr_funders` <- function(dois = NULL, query = NULL, filter = NULL, offset = NULL, limit = NULL, sample = NULL, sort = NULL, order = NULL, facet=FALSE, works = FALSE, cursor = NULL, cursor_max = 5000, .progress="none", ...) { - .Deprecated( - msg = - "function name changing to cr_funders in the next version\nboth work for now" - ) args <- prep_args(query, filter, offset, limit, sample, sort, order, facet, cursor) if (length(dois) > 1) { @@ -137,11 +133,7 @@ } #' @export -#' @rdname cr_fundref -`cr_funders` <- `cr_fundref` - -#' @export -#' @rdname cr_fundref +#' @rdname cr_funders `cr_funders_` <- function(dois = NULL, query = NULL, filter = NULL, offset = NULL, limit = NULL, sample = NULL, sort = NULL, order = NULL, facet=FALSE, works = FALSE, cursor = NULL, cursor_max = 5000, diff --git a/R/cr_search.r b/R/cr_search.r index 839b27a..edd2c53 100644 --- a/R/cr_search.r +++ b/R/cr_search.r @@ -1,93 +1,11 @@ #' Search the CrossRef Metatdata API. -#' +#' #' @export -#' -#' @param query Query terms. -#' @param doi Search by a single DOI or many DOIs. -#' @param page Page to return from results. -#' @param rows Number of records to return. -#' @param sort Sort either by "score" or "year". -#' @param year Year to search. -#' @param type Record type, e.g., "Journal Article" or "Journal Issue" -#' @param ... Named parameters passed on to \code{\link[httr]{GET}} -#' -#' @details See \url{http://search.labs.crossref.org/help/api} for more -#' info on this Crossref API service. -#' @seealso \code{\link{cr_r}}, \code{\link{cr_citation}}, -#' \code{\link{cr_search_free}} -#' @author Scott Chamberlain \email{myrmecocystus@@gmail.com} -#' @examples \dontrun{ -#' cr_search(query = c("renear", "palmer")) -#' -#' # limit to 4 results -#' cr_search(query = c("renear", "palmer"), rows = 4) -#' -#' # get more results than standard -#' cr_search(query = c("renear", "palmer"), rows = 40) -#' -#' # sort results by score -#' cr_search(query = c("renear", "palmer"), rows = 10, sort = "score") -#' -#' # sort results by year -#' cr_search(query = c("renear", "palmer"), rows = 10, sort = "year") -#' -#' # get results for a certain year -#' cr_search(query = c("renear", "palmer"), year = 2010) -#' -#' # search by a single DOI -#' cr_search(doi = "10.1890/10-0340.1") -#' -#' # search for many DOI's -#' # find all the records of articles from a journal ISBN -#' cr_search(query = "1461-0248", type="Journal Article") -#' -#' # curl stuff -#' library('httr') -#' cr_search(doi = "10.1890/10-0340.1", config=verbose()) -#' cr_search(query = c("renear", "palmer"), rows = 40, config=progress()) -#' } - -`cr_search` <- function(query=NULL, doi=NULL, page=NULL, rows=NULL, sort=NULL, - year=NULL, type=NULL, ...) { - - .Deprecated( - package = "rcrossref", - msg = "cr_search is deprecated, and will be removed in next version, see cr_works et al." +#' @rdname cr_search-defunct +#' @keywords internal +`cr_search` <- function(...) { + .Defunct( + package = "rcrossref", + msg = "Removed - see cr_works(), cr_journals(), etc. for similar functionality" ) - url <- "http://search.crossref.org/dois" - if (!is.null(doi)) { - doi <- as.character(doi) - } - if (is.null(doi)) { - cr_search_GET(url, query, page, rows, sort, year, type, ...) - } else { - ldply(doi, function(z) cr_search_GET(url, x = z, page, rows, sort, - year, type, ...)) - } -} - -cr_search_GET <- function(url, x, page, rows, sort, year, type, ...){ - if (!is.null(x)) { - if (length(x) > 1) x <- paste0(x, collapse = " ") - } - args <- cr_compact(list(q = x, page = page, rows = rows, - sort = sort, year = year, type = type)) - tt <- GET(url, query = args, make_rcrossref_ua(), ...) - stop_for_status(tt) - res <- ct_utf8(tt) - tmp <- jsonlite::fromJSON(res) - if (NROW(tmp) == 0) { - NULL - } else { - col_classes( - tmp, - c("character","numeric","integer","character", - "character","character","numeric") - ) - } -} - -asnum <- function(x){ - tmp <- tryCatch(as.numeric(x), warning = function(w) w) - if (inherits(tmp, "simpleWarning")) x else tmp } diff --git a/R/cr_search_free.r b/R/cr_search_free.r index bde755b..db79fcb 100644 --- a/R/cr_search_free.r +++ b/R/cr_search_free.r @@ -1,50 +1,11 @@ #' Search the CrossRef Metatdata for DOIs using free form references. #' #' @export -#' -#' @param query Reference query; a character vector of length 1 or greater, -#' comma-separated of course. -#' @param url Base url for the Crossref metadata API. -#' -#' @details Have to have at least three terms in each search query. -#' @seealso \code{\link{cr_search}}, \code{\link{cr_r}}, -#' \code{\link{cr_citation}} -#' @author Scott Chamberlain \email{myrmecocystus@@gmail.com} -#' @examples \dontrun{ -#' # search with title, author, year, and journal -#' cr_search_free(query = "Piwowar Sharing Detailed Research Data Is -#' Associated with Increased Citation Rate PLOS one 2007") -#' -#' cr_search_free(query="Renear 2012") # too few words, need at least 3 -#' -#' # multiple queries -#' cr_search_free(query=c("Renear 2012","Piwowar sharing data PLOS one")) -#' -#' # Get a DOI and get the citation using cr_search -#' doi <- cr_search_free(query="Piwowar sharing data PLOS one")$doi -#' cr_search(doi = doi) -#' -#' # Queries can be quite complex too -#' cr_search_free("M. Henrion, D. J. Mortlock, D. J. Hand, and A. Gandy, -#' \"A Bayesian approach to star-galaxy classification,\" Monthly Notices of -#' the Royal Astronomical Society, vol. 412, no. 4, pp. 2286-2302, Apr. 2011.") -#' -#' # Lots of queries -#' queries <- c( -#' "Piwowar sharing data PLOS one", "Priem Scientometrics 2.0 social web", -#' "William Gunn A Crosstalk Between Myeloma Cells", -#' "karthik ram Metapopulation dynamics override local limits") -#' cr_search_free(queries) -#' } - -`cr_search_free` <- function(query, url = "http://search.crossref.org/links") { - .Deprecated(package = "rcrossref", - msg = "cr_search_free is deprecated, and will be removed in next version, see cr_works et al.") - tt <- POST( - url, - config = c(content_type_json(), accept_json()), - body = jsonlite::toJSON(query)) - stop_for_status(tt) - res <- ct_utf8(tt) - fromJSON(res)$results +#' @rdname cr_search_free-defunct +#' @keywords internal +`cr_search_free` <- function(...) { + .Defunct( + package = "rcrossref", + msg = "Removed - see cr_works(), cr_journals(), etc. for similar functionality" + ) } diff --git a/R/crosscite.R b/R/crosscite.R index 2b43dce..c69318f 100644 --- a/R/crosscite.R +++ b/R/crosscite.R @@ -1,54 +1,11 @@ #' Crosscite - citation formatter #' #' @export -#' @param dois Search by a single DOI or many DOIs. -#' @param style a CSL style (for text format only). See -#' \code{\link{get_styles}} for options. Default: apa. If there's a style that -#' CrossRef doesn't support you'll get a \code{(500) Internal Server Error} -#' @param locale Language locale. See \code{?Sys.getlocale} -#' @template moreargs -#' @details See \url{http://www.crosscite.org/cn/} for more info on the -#' Crossref Content Negotiation API service. -#' -#' This function is now deprecated. It will be removed in the next version -#' of this package. Use \code{\link{cr_cn}} instead. -#' -#' @examples \dontrun{ -#' crosscite("10.5284/1011335") -#' crosscite(c('10.5169/SEALS-52668','10.2314/GBV:493109919', -#' '10.2314/GBV:493105263', '10.2314/GBV:487077911', -#' '10.2314/GBV:607866403')) -#' } - -`crosscite` <- function(dois, style = 'apa', locale = "en-US", - .progress = "none", ...) { - - .Deprecated( - new = "cr_cn", - package = "rcrossref", - msg = "crosscite is deprecated - will be removed in next version, use cr_cn" +#' @rdname crosscite-defunct +#' @keywords internal +`crosscite` <- function(...) { + .Defunct( + package = "rcrossref", + msg = "Removed - see cr_works(), cr_journals(), etc. for similar functionality" ) - if (length(dois) > 1) { - llply(dois, function(z, ...) { - out <- try(ccite(z, style, locale, ...), silent=TRUE) - if ("try-error" %in% class(out)) { - warning( - paste0("Failure in resolving '", z, "'. See error detail in results.") - ) - out <- list(doi=z, error=out[[1]]) - } - return(out) - }, .progress=.progress) - } else { - ccite(dois, style, locale, ...) - } -} - -ccite <- function(doi, style, locale, ...) { - args <- cr_compact(list(doi = doi, style = style, locale = locale)) - res <- GET(ccurl(), query = args, make_rcrossref_ua(), ...) - stop_for_status(res) - gsub("\n", "", ct_utf8(res)) } - -ccurl <- function() "http://crosscite.org/citeproc/format" diff --git a/R/deprecated_defunct.R b/R/deprecated_defunct.R index 588c2cf..a1d1239 100644 --- a/R/deprecated_defunct.R +++ b/R/deprecated_defunct.R @@ -3,14 +3,22 @@ #' These functions still work but will be removed (defunct) in the next version. #' #' \itemize{ -#' \item \code{\link{cr_search}}: The functionality of this function can -#' be achieved with the new Crossref API. See functions \code{\link{cr_works}} -#' et al. -#' \item \code{\link{cr_search_free}}: The functionality of this function can -#' be achieved with the new Crossref API. See functions \code{\link{cr_works}} -#' et al. -#' \item \code{\link{crosscite}}: The functionality of this function can be -#' achieved with \code{\link{cr_cn}} +#' \item \code{\link{cr_ft_text}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{cr_ft_links}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{cr_ft_pdf}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{cr_ft_plain}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{cr_ft_text}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{cr_ft_xml}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{as.tdmurl}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. +#' \item \code{\link{extract_xpdf}}: This function and other text mining +#' functions are being incorporated in a new package \code{crminer}. #' } #' #' @name rcrossref-deprecated @@ -28,7 +36,30 @@ NULL #' \item \code{\link{pmid2doi}} and \code{\link{doi2pmid}}: The API behind #' these functions is down for good, see \code{\link{id_converter}} for #' similar functionality. +#' \item \code{\link{cr_search}}: The functionality of this function can +#' be achieved with the new Crossref API. See functions \code{\link{cr_works}} +#' et al. +#' \item \code{\link{cr_search_free}}: The functionality of this function can +#' be achieved with the new Crossref API. See functions \code{\link{cr_works}} +#' et al. +#' \item \code{\link{crosscite}}: The functionality of this function can be +#' achieved with \code{\link{cr_cn}} +#' \item \code{\link{cr_fundref}}: Crossref changed their name "fundref" +#' to "funders", so we've changed our function, see \code{\link{cr_funders}} #' } #' #' @name rcrossref-defunct NULL + +#' fundref +#' +#' @export +#' @rdname cr_fundref-defunct +#' @keywords internal +`cr_fundref` <- function(...) { + .Defunct( + new = "cr_funders", + package = "rcrossref", + msg = "Removed - see cr_funders()" + ) +} diff --git a/R/rcrossref-package.R b/R/rcrossref-package.R index 3de99f5..ad26f1f 100644 --- a/R/rcrossref-package.R +++ b/R/rcrossref-package.R @@ -4,7 +4,8 @@ #' rcrossref interacts with the main Crossref metadata search API at #' \url{https://github.com/CrossRef/rest-api-doc/blob/master/rest_api.md}, #' the old metadata search API at \url{http://search.labs.crossref.org/}, their -#' DOI Content Negotiation service at \url{http://www.crosscite.org/cn/}, and +#' DOI Content Negotiation service at +#' \url{http://citation.crosscite.org/docs.html}, and #' the \emph{Text and Data Mining} project \url{http://tdmsupport.crossref.org/} #' #' @section Deprecated and Defunct: diff --git a/README.Rmd b/README.Rmd index 32f7dad..c87f565 100644 --- a/README.Rmd +++ b/README.Rmd @@ -84,7 +84,7 @@ The following functions all use the [CrossRef API](https://github.com/CrossRef/r ### Look up funder information ```{r} -cr_fundref(query = "NSF") +cr_funders(query = "NSF") ``` ### Check the DOI minting agency diff --git a/README.md b/README.md index 9043694..62ccaa0 100644 --- a/README.md +++ b/README.md @@ -80,9 +80,10 @@ cat(cr_cn(dois = "10.1126/science.169.3946.635", format = "bibtex")) ```r cr_cn(dois = "10.6084/m9.figshare.97218", format = "bibentry") -#> Boettiger; C (2012). "Regime shifts in ecology and evolution (PhD -#> Dissertation)." , -#> . +#> Boettiger C (2012). "Regime shifts in ecology and evolution (PhD +#> Dissertation)." doi: 10.6084/m9.figshare.97218 (URL: +#> http://doi.org/10.6084/m9.figshare.97218), https://doi.org/10.6084/m9.figshare.97218>. ``` ## Citation count @@ -92,7 +93,7 @@ Citation count, using OpenURL ```r cr_citation_count(doi = "10.1371/journal.pone.0042793") -#> [1] 7 +#> [1] 10 ``` ## Search Crossref metadata API @@ -103,25 +104,25 @@ The following functions all use the [CrossRef API](https://github.com/CrossRef/r ```r -cr_fundref(query = "NSF") +cr_funders(query = "NSF") #> $meta #> total_results search_terms start_index items_per_page #> 1 8 NSF 0 20 #> #> $data -#> Source: local data frame [8 x 6] -#> +#> # A tibble: 8 × 6 #> id location -#> (chr) (chr) -#> 1 501100000930 Australia -#> 2 100000001 United States -#> 3 100003187 United States -#> 4 100008367 Denmark -#> 5 501100004190 Norway -#> 6 100000179 United States -#> 7 100006445 United States +#> +#> 1 100003187 United States +#> 2 100008367 Denmark +#> 3 501100004190 Norway +#> 4 100000179 United States +#> 5 100006445 United States +#> 6 501100000930 Australia +#> 7 100000001 United States #> 8 501100001809 China -#> Variables not shown: name (chr), alt.names (chr), uri (chr), tokens (chr) +#> # ... with 4 more variables: name , alt.names , uri , +#> # tokens ``` ### Check the DOI minting agency @@ -147,19 +148,18 @@ cr_agency(dois = '10.13039/100000001') cr_works(filter = c(has_orcid = TRUE, from_pub_date = '2004-04-04'), limit = 1) #> $meta #> total_results search_terms start_index items_per_page -#> 1 254101 NA 0 1 +#> 1 419209 NA 0 1 #> #> $data -#> Source: local data frame [1 x 23] -#> +#> # A tibble: 1 × 24 #> alternative.id container.title created deposited -#> (chr) (chr) (chr) (chr) +#> #> 1 2015-11-11 2015-11-11 -#> Variables not shown: DOI (chr), funder (chr), indexed (chr), ISBN (chr), -#> ISSN (chr), issued (chr), link (chr), member (chr), prefix (chr), -#> publisher (chr), reference.count (chr), score (chr), source (chr), -#> subject (chr), title (chr), type (chr), URL (chr), assertion (chr), -#> author (chr) +#> # ... with 20 more variables: DOI , funder , indexed , +#> # ISBN , ISSN , issued , link , member , +#> # prefix , publisher , reference.count , score , +#> # source , subject , title , type , URL , +#> # assertion , author , `clinical-trial-number` #> #> $facets #> NULL @@ -170,14 +170,14 @@ cr_works(filter = c(has_orcid = TRUE, from_pub_date = '2004-04-04'), limit = 1) ```r cr_journals(issn = c('1803-2427','2326-4225')) -#> Source: local data frame [2 x 15] -#> +#> # A tibble: 2 × 16 #> alternative.id container.title created deposited funder indexed ISBN -#> (chr) (chr) (chr) (chr) (chr) (chr) (chr) +#> #> 1 #> 2 -#> Variables not shown: ISSN (chr), issued (chr), link (chr), publisher -#> (chr), subject (chr), title (chr), assertion (chr), author (chr) +#> # ... with 9 more variables: ISSN , issued , link , +#> # publisher , subject , title , assertion , +#> # author , `clinical-trial-number` ``` ### Search license information @@ -187,25 +187,26 @@ cr_journals(issn = c('1803-2427','2326-4225')) cr_licenses(query = 'elsevier') #> $meta #> total_results search_terms start_index items_per_page -#> 1 11 elsevier 0 20 +#> 1 13 elsevier 0 20 #> #> $data -#> Source: local data frame [11 x 2] -#> +#> # A tibble: 13 × 2 #> URL -#> (chr) +#> #> 1 http://creativecommons.org/licenses/by-nc-nd/3.0/ #> 2 http://creativecommons.org/licenses/by-nc-nd/4.0/ -#> 3 http://creativecommons.org/licenses/by/3.0/ -#> 4 http://doi.wiley.com/10.1002/tdm_license_1 -#> 5 http://onlinelibrary.wiley.com/termsAndConditions -#> 6 http://www.acm.org/publications/policies/copyright_policy#Background -#> 7 http://www.elsevier.com/open-access/userlicense/1.0/ -#> 8 http://www.elsevier.com/tdm/userlicense/1.0/ -#> 9 http://www.springer.com/tdm -#> 10 © 2007 Elsevier Masson SAS. All rights reserved. The patient figure in Figu -#> 11 © 2012, Elsevier Inc., All Rights Reserved. Figure 8, part (B) (images of H -#> Variables not shown: work.count (int) +#> 3 http://creativecommons.org/licenses/by-nc/4.0/ +#> 4 http://creativecommons.org/licenses/by/3.0/ +#> 5 http://creativecommons.org/licenses/by/4.0/ +#> 6 http://doi.wiley.com/10.1002/tdm_license_1 +#> 7 http://onlinelibrary.wiley.com/termsAndConditions +#> 8 http://www.acm.org/publications/policies/copyright_policy#Background +#> 9 http://www.elsevier.com/open-access/userlicense/1.0/ +#> 10 http://www.elsevier.com/tdm/userlicense/1.0/ +#> 11 http://www.springer.com/tdm +#> 12 © 2007 Elsevier Masson SAS. All rights reserved. The patient figure in Figu +#> 13 © 2012, Elsevier Inc., All Rights Reserved. Figure 8, part (B) (images of H +#> # ... with 1 more variables: work.count ``` ### Search based on DOI prefixes @@ -217,16 +218,18 @@ cr_prefixes(prefixes = c('10.1016','10.1371','10.1023','10.4176','10.1093')) #> NULL #> #> $data -#> Source: local data frame [5 x 3] -#> -#> member name -#> (chr) (chr) -#> 1 http://id.crossref.org/member/78 Elsevier BV -#> 2 http://id.crossref.org/member/340 Public Library of Science (PLoS) -#> 3 http://id.crossref.org/member/297 Springer Science + Business Media -#> 4 http://id.crossref.org/member/1989 Co-Action Publishing -#> 5 http://id.crossref.org/member/286 Oxford University Press (OUP) -#> Variables not shown: prefix (chr) +#> member name +#> 1 http://id.crossref.org/member/78 Elsevier BV +#> 2 http://id.crossref.org/member/340 Public Library of Science (PLoS) +#> 3 http://id.crossref.org/member/297 Springer Nature +#> 4 http://id.crossref.org/member/1989 Co-Action Publishing +#> 5 http://id.crossref.org/member/286 Oxford University Press (OUP) +#> prefix +#> 1 http://id.crossref.org/prefix/10.1016 +#> 2 http://id.crossref.org/prefix/10.1371 +#> 3 http://id.crossref.org/prefix/10.1023 +#> 4 http://id.crossref.org/prefix/10.4176 +#> 5 http://id.crossref.org/prefix/10.1093 #> #> $facets #> list() @@ -239,40 +242,51 @@ cr_prefixes(prefixes = c('10.1016','10.1371','10.1023','10.4176','10.1093')) cr_members(query = 'ecology', limit = 5) #> $meta #> total_results search_terms start_index items_per_page -#> 1 17 ecology 0 5 +#> 1 18 ecology 0 5 #> #> $data -#> Source: local data frame [5 x 40] -#> -#> id primary_name -#> (int) (chr) -#> 1 7052 Chinese Journal of Plant Ecology -#> 2 6933 Knowledge Ecology International -#> 3 7278 Korean Society of Ecology and Infrastructure Engineering -#> 4 7745 Institute of Applied Ecology -#> 5 336 Japanese Society of Microbial Ecology -#> Variables not shown: location (chr), last_status_check_time (date), -#> backfile.dois (chr), current.dois (chr), total.dois (chr), prefixes -#> (chr), coverge.funders.backfile (chr), coverge.licenses.backfile (chr), -#> coverge.funders.current (chr), coverge.resource.links.backfile (chr), -#> coverge.orcids.backfile (chr), coverge.update.policies.current (chr), -#> coverge.orcids.current (chr), coverge.references.backfile (chr), -#> coverge.award.numbers.backfile (chr), coverge.update.policies.backfile -#> (chr), coverge.licenses.current (chr), coverge.award.numbers.current -#> (chr), coverge.resource.links.current (chr), coverge.references.current -#> (chr), flags.deposits.orcids.current (chr), flags.deposits (chr), -#> flags.deposits.update.policies.backfile (chr), -#> flags.deposits.award.numbers.current (chr), -#> flags.deposits.resource.links.current (chr), flags.deposits.articles -#> (chr), flags.deposits.funders.current (chr), -#> flags.deposits.references.backfile (chr), -#> flags.deposits.licenses.backfile (chr), -#> flags.deposits.award.numbers.backfile (chr), -#> flags.deposits.references.current (chr), -#> flags.deposits.resource.links.backfile (chr), -#> flags.deposits.orcids.backfile (chr), flags.deposits.funders.backfile -#> (chr), flags.deposits.update.policies.current (chr), -#> flags.deposits.licenses.current (chr), names (chr), tokens (chr) +#> # A tibble: 5 × 48 +#> id +#> +#> 1 7052 +#> 2 6933 +#> 3 7278 +#> 4 7745 +#> 5 9167 +#> # ... with 47 more variables: primary_name , location , +#> # last_status_check_time , backfile.dois , +#> # current.dois , total.dois , prefixes , +#> # coverge.affiliations.current , coverge.funders.backfile , +#> # coverge.licenses.backfile , coverge.funders.current , +#> # coverge.affiliations.backfile , +#> # coverge.resource.links.backfile , coverge.orcids.backfile , +#> # coverge.update.policies.current , coverge.orcids.current , +#> # coverge.references.backfile , +#> # coverge.award.numbers.backfile , +#> # coverge.update.policies.backfile , +#> # coverge.licenses.current , coverge.award.numbers.current , +#> # coverge.abstracts.backfile , +#> # coverge.resource.links.current , coverge.abstracts.current , +#> # coverge.references.current , +#> # flags.deposits.abstracts.current , +#> # flags.deposits.orcids.current , flags.deposits , +#> # flags.deposits.affiliations.backfile , +#> # flags.deposits.update.policies.backfile , +#> # flags.deposits.award.numbers.current , +#> # flags.deposits.resource.links.current , +#> # flags.deposits.articles , +#> # flags.deposits.affiliations.current , +#> # flags.deposits.funders.current , +#> # flags.deposits.references.backfile , +#> # flags.deposits.abstracts.backfile , +#> # flags.deposits.licenses.backfile , +#> # flags.deposits.award.numbers.backfile , +#> # flags.deposits.references.current , +#> # flags.deposits.resource.links.backfile , +#> # flags.deposits.orcids.backfile , +#> # flags.deposits.funders.backfile , +#> # flags.deposits.update.policies.current , +#> # flags.deposits.licenses.current , names , tokens #> #> $facets #> NULL @@ -285,11 +299,11 @@ cr_members(query = 'ecology', limit = 5) ```r cr_r() -#> [1] "10.5594/j16363" "10.1093/icsidreview/23.1.164" -#> [3] "10.1007/bf03302528" "10.1163/1877-8054_cmri_com_24648" -#> [5] "10.1080/08911916.1996.11643918" "10.1007/978-94-011-1472-1_34" -#> [7] "10.4267/10608/4227" "10.1103/physrevd.36.527" -#> [9] "10.1002/pam.20136" "10.1016/j.ijleo.2015.09.110" +#> [1] "10.1007/springerreference_78003" "10.1093/llc/6.4.307" +#> [3] "10.3917/riges.374.0067" "10.1016/0091-3057(79)90213-2" +#> [5] "10.5594/j03208" "10.1039/c1jm14024h" +#> [7] "10.1039/c4ra09007a" "10.1542/peds.2010-2702" +#> [9] "10.1016/s0140-6736(74)93081-5" "10.1177/0885066603018003009" ``` You can pass in the number of DOIs you want back (default is 10) @@ -297,7 +311,7 @@ You can pass in the number of DOIs you want back (default is 10) ```r cr_r(2) -#> [1] "10.1201/b19172-3" "10.4236/msce.2013.15009" +#> [1] "10.1080/14942119.2016.1157994" "10.2307/201048" ``` ## pmid2doi & doi2pmid @@ -318,16 +332,13 @@ out <- cr_works(filter = list(has_full_text = TRUE, license_url = "http://creativecommons.org/licenses/by/3.0/")) (dois <- out$data$DOI) -#> [1] "10.1155/2015/108274" "10.1016/j.susc.2014.02.008" -#> [3] "10.1155/2014/152487" "10.1016/j.susc.2014.03.018" -#> [5] "10.1155/2014/101496" "10.1155/2014/156438" -#> [7] "10.1155/1989/60313" "10.1155/2008/683505" -#> [9] "10.1155/2009/867380" "10.1155/2009/316249" -#> [11] "10.4061/2010/147142" "10.1155/2010/285376" -#> [13] "10.5402/2011/736062" "10.1155/2011/434375" -#> [15] "10.1155/2011/891593" "10.1155/2010/282464" -#> [17] "10.1155/2011/875028" "10.1155/2011/463704" -#> [19] "10.1155/2011/129341" "10.1155/2011/814794" +#> [1] "10.1063/1.4905711" "10.1063/1.4908245" "10.1063/1.4908158" +#> [4] "10.1063/1.4908244" "10.1063/1.4913247" "10.1063/1.4914847" +#> [7] "10.1063/1.4916217" "10.1063/1.4916677" "10.1063/1.4916696" +#> [10] "10.1063/1.4917283" "10.1063/1.4918284" "10.1063/1.4919707" +#> [13] "10.1063/1.4921711" "10.1063/1.4921771" "10.1063/1.4922319" +#> [16] "10.1063/1.4922934" "10.1063/1.4922006" "10.1063/1.4926610" +#> [19] "10.1063/1.4926838" "10.1063/1.4926914" ``` Then get URLs to full text content @@ -335,7 +346,7 @@ Then get URLs to full text content ```r (links <- cr_ft_links(dois[1])) -#> http://downloads.hindawi.com/journals/cmmm/2015/108274.xml +#> NULL ``` Then use those URLs to get full text diff --git a/inst/vign/crossref_vignette.Rmd b/inst/vign/crossref_vignette.Rmd index e6a77f7..0a24b3c 100644 --- a/inst/vign/crossref_vignette.Rmd +++ b/inst/vign/crossref_vignette.Rmd @@ -33,7 +33,7 @@ library("rcrossref") ## Citation search -CrossRef's [DOI Content Negotiation](http://www.crosscite.org/cn/) service, where you can citations back in various formats, including `apa` +CrossRef's [DOI Content Negotiation](http://citation.crosscite.org/docs.html) service, where you can citations back in various formats, including `apa` ```{r} cr_cn(dois = "10.1371/journal.pone.0112608", format = "text", style = "apa") @@ -72,7 +72,7 @@ There are two functions that use an older Crossre API: `cr_search()` and `cr_sea ### Look up funder information ```{r} -cr_fundref(query="NSF") +cr_funders(query="NSF") ``` ### Check the DOI minting agency diff --git a/inst/vign/crossref_vignette.md b/inst/vign/crossref_vignette.md index 7b834e5..864dcac 100644 --- a/inst/vign/crossref_vignette.md +++ b/inst/vign/crossref_vignette.md @@ -29,7 +29,7 @@ library("rcrossref") ## Citation search -CrossRef's [DOI Content Negotiation](http://www.crosscite.org/cn/) service, where you can citations back in various formats, including `apa` +CrossRef's [DOI Content Negotiation](http://citation.crosscite.org/docs.html) service, where you can citations back in various formats, including `apa` ```r @@ -112,7 +112,7 @@ There are two functions that use an older Crossre API: `cr_search()` and `cr_sea ```r -cr_fundref(query="NSF") +cr_funders(query="NSF") ``` ``` @@ -121,19 +121,19 @@ cr_fundref(query="NSF") #> 1 8 NSF 0 20 #> #> $data -#> Source: local data frame [8 x 6] -#> +#> # A tibble: 8 × 6 #> id location -#> (chr) (chr) -#> 1 501100000930 Australia -#> 2 100000001 United States -#> 3 100003187 United States -#> 4 100008367 Denmark -#> 5 501100004190 Norway -#> 6 100000179 United States -#> 7 100006445 United States +#> +#> 1 100003187 United States +#> 2 100008367 Denmark +#> 3 501100004190 Norway +#> 4 100000179 United States +#> 5 100006445 United States +#> 6 501100000930 Australia +#> 7 100000001 United States #> 8 501100001809 China -#> Variables not shown: name (chr), alt.names (chr), uri (chr), tokens (chr) +#> # ... with 4 more variables: name , alt.names , uri , +#> # tokens ``` ### Check the DOI minting agency diff --git a/man/cr_cn.Rd b/man/cr_cn.Rd index 3b49df1..c47c2cf 100644 --- a/man/cr_cn.Rd +++ b/man/cr_cn.Rd @@ -35,8 +35,8 @@ etc.)} Get citations in various formats from CrossRef. } \details{ -See \url{http://www.crosscite.org/cn/} for more info on the Crossref - Content Negotiation API service. +See \url{http://citation.crosscite.org/docs.html} for more info +on the Crossref Content Negotiation API service. DataCite DOIs: Some values of the \code{format} parameter won't work with DataCite DOIs, i.e. "citeproc-json", "crossref-xml", "crossref-tdm", diff --git a/man/cr_fundref.Rd b/man/cr_funders.Rd similarity index 94% rename from man/cr_fundref.Rd rename to man/cr_funders.Rd index 1895415..9162ef3 100644 --- a/man/cr_fundref.Rd +++ b/man/cr_funders.Rd @@ -1,16 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/cr_fundref.r -\name{cr_fundref} +\name{cr_funders} \alias{cr_funders} \alias{cr_funders_} -\alias{cr_fundref} \title{Search the CrossRef Fundref API} \usage{ -cr_fundref(dois = NULL, query = NULL, filter = NULL, offset = NULL, - limit = NULL, sample = NULL, sort = NULL, order = NULL, - facet = FALSE, works = FALSE, cursor = NULL, cursor_max = 5000, - .progress = "none", ...) - cr_funders(dois = NULL, query = NULL, filter = NULL, offset = NULL, limit = NULL, sample = NULL, sort = NULL, order = NULL, facet = FALSE, works = FALSE, cursor = NULL, cursor_max = 5000, diff --git a/man/cr_fundref-defunct.Rd b/man/cr_fundref-defunct.Rd new file mode 100644 index 0000000..19f64e6 --- /dev/null +++ b/man/cr_fundref-defunct.Rd @@ -0,0 +1,13 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/deprecated_defunct.R +\name{cr_fundref} +\alias{cr_fundref} +\title{fundref} +\usage{ +cr_fundref(...) +} +\description{ +fundref +} +\keyword{internal} + diff --git a/man/cr_search-defunct.Rd b/man/cr_search-defunct.Rd new file mode 100644 index 0000000..c7a8a19 --- /dev/null +++ b/man/cr_search-defunct.Rd @@ -0,0 +1,13 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cr_search.r +\name{cr_search} +\alias{cr_search} +\title{Search the CrossRef Metatdata API.} +\usage{ +cr_search(...) +} +\description{ +Search the CrossRef Metatdata API. +} +\keyword{internal} + diff --git a/man/cr_search.Rd b/man/cr_search.Rd deleted file mode 100644 index 457059d..0000000 --- a/man/cr_search.Rd +++ /dev/null @@ -1,73 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/cr_search.r -\name{cr_search} -\alias{cr_search} -\title{Search the CrossRef Metatdata API.} -\usage{ -cr_search(query = NULL, doi = NULL, page = NULL, rows = NULL, - sort = NULL, year = NULL, type = NULL, ...) -} -\arguments{ -\item{query}{Query terms.} - -\item{doi}{Search by a single DOI or many DOIs.} - -\item{page}{Page to return from results.} - -\item{rows}{Number of records to return.} - -\item{sort}{Sort either by "score" or "year".} - -\item{year}{Year to search.} - -\item{type}{Record type, e.g., "Journal Article" or "Journal Issue"} - -\item{...}{Named parameters passed on to \code{\link[httr]{GET}}} -} -\description{ -Search the CrossRef Metatdata API. -} -\details{ -See \url{http://search.labs.crossref.org/help/api} for more -info on this Crossref API service. -} -\examples{ -\dontrun{ -cr_search(query = c("renear", "palmer")) - -# limit to 4 results -cr_search(query = c("renear", "palmer"), rows = 4) - -# get more results than standard -cr_search(query = c("renear", "palmer"), rows = 40) - -# sort results by score -cr_search(query = c("renear", "palmer"), rows = 10, sort = "score") - -# sort results by year -cr_search(query = c("renear", "palmer"), rows = 10, sort = "year") - -# get results for a certain year -cr_search(query = c("renear", "palmer"), year = 2010) - -# search by a single DOI -cr_search(doi = "10.1890/10-0340.1") - -# search for many DOI's -# find all the records of articles from a journal ISBN -cr_search(query = "1461-0248", type="Journal Article") - -# curl stuff -library('httr') -cr_search(doi = "10.1890/10-0340.1", config=verbose()) -cr_search(query = c("renear", "palmer"), rows = 40, config=progress()) -} -} -\author{ -Scott Chamberlain \email{myrmecocystus@gmail.com} -} -\seealso{ -\code{\link{cr_r}}, \code{\link{cr_citation}}, -\code{\link{cr_search_free}} -} - diff --git a/man/cr_search_free-defunct.Rd b/man/cr_search_free-defunct.Rd new file mode 100644 index 0000000..bc5176a --- /dev/null +++ b/man/cr_search_free-defunct.Rd @@ -0,0 +1,13 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/cr_search_free.r +\name{cr_search_free} +\alias{cr_search_free} +\title{Search the CrossRef Metatdata for DOIs using free form references.} +\usage{ +cr_search_free(...) +} +\description{ +Search the CrossRef Metatdata for DOIs using free form references. +} +\keyword{internal} + diff --git a/man/cr_search_free.Rd b/man/cr_search_free.Rd deleted file mode 100644 index c8cbcc2..0000000 --- a/man/cr_search_free.Rd +++ /dev/null @@ -1,56 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/cr_search_free.r -\name{cr_search_free} -\alias{cr_search_free} -\title{Search the CrossRef Metatdata for DOIs using free form references.} -\usage{ -cr_search_free(query, url = "http://search.crossref.org/links") -} -\arguments{ -\item{query}{Reference query; a character vector of length 1 or greater, -comma-separated of course.} - -\item{url}{Base url for the Crossref metadata API.} -} -\description{ -Search the CrossRef Metatdata for DOIs using free form references. -} -\details{ -Have to have at least three terms in each search query. -} -\examples{ -\dontrun{ -# search with title, author, year, and journal -cr_search_free(query = "Piwowar Sharing Detailed Research Data Is -Associated with Increased Citation Rate PLOS one 2007") - -cr_search_free(query="Renear 2012") # too few words, need at least 3 - -# multiple queries -cr_search_free(query=c("Renear 2012","Piwowar sharing data PLOS one")) - -# Get a DOI and get the citation using cr_search -doi <- cr_search_free(query="Piwowar sharing data PLOS one")$doi -cr_search(doi = doi) - -# Queries can be quite complex too -cr_search_free("M. Henrion, D. J. Mortlock, D. J. Hand, and A. Gandy, -\\"A Bayesian approach to star-galaxy classification,\\" Monthly Notices of -the Royal Astronomical Society, vol. 412, no. 4, pp. 2286-2302, Apr. 2011.") - -# Lots of queries -queries <- c( - "Piwowar sharing data PLOS one", "Priem Scientometrics 2.0 social web", -"William Gunn A Crosstalk Between Myeloma Cells", - "karthik ram Metapopulation dynamics override local limits") -cr_search_free(queries) -} -} -\author{ -Scott Chamberlain \email{myrmecocystus@gmail.com} -} -\seealso{ -\code{\link{cr_search}}, \code{\link{cr_r}}, -\code{\link{cr_citation}} -} - diff --git a/man/crosscite-defunct.Rd b/man/crosscite-defunct.Rd new file mode 100644 index 0000000..1c21fdc --- /dev/null +++ b/man/crosscite-defunct.Rd @@ -0,0 +1,13 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/crosscite.R +\name{crosscite} +\alias{crosscite} +\title{Crosscite - citation formatter} +\usage{ +crosscite(...) +} +\description{ +Crosscite - citation formatter +} +\keyword{internal} + diff --git a/man/crosscite.Rd b/man/crosscite.Rd deleted file mode 100644 index 2c7f0d8..0000000 --- a/man/crosscite.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/crosscite.R -\name{crosscite} -\alias{crosscite} -\title{Crosscite - citation formatter} -\usage{ -crosscite(dois, style = "apa", locale = "en-US", .progress = "none", ...) -} -\arguments{ -\item{dois}{Search by a single DOI or many DOIs.} - -\item{style}{a CSL style (for text format only). See -\code{\link{get_styles}} for options. Default: apa. If there's a style that -CrossRef doesn't support you'll get a \code{(500) Internal Server Error}} - -\item{locale}{Language locale. See \code{?Sys.getlocale}} - -\item{.progress}{Show a \code{plyr}-style progress bar? Options are "none", "text", -"tk", "win", and "time". See \code{\link[plyr]{create_progress_bar}} for details -of each. Only used when passing in multiple ids (e.g., multiple DOIs, DOI prefixes, -etc.)} - -\item{...}{Named parameters passed on to \code{\link[httr]{GET}}} -} -\description{ -Crosscite - citation formatter -} -\details{ -See \url{http://www.crosscite.org/cn/} for more info on the - Crossref Content Negotiation API service. - -This function is now deprecated. It will be removed in the next version -of this package. Use \code{\link{cr_cn}} instead. -} -\examples{ -\dontrun{ -crosscite("10.5284/1011335") -crosscite(c('10.5169/SEALS-52668','10.2314/GBV:493109919', - '10.2314/GBV:493105263', '10.2314/GBV:487077911', - '10.2314/GBV:607866403')) -} -} - diff --git a/man/rcrossref-defunct.Rd b/man/rcrossref-defunct.Rd index e19a423..dfa6248 100644 --- a/man/rcrossref-defunct.Rd +++ b/man/rcrossref-defunct.Rd @@ -15,6 +15,16 @@ These functions are gone, no longer available. \item \code{\link{pmid2doi}} and \code{\link{doi2pmid}}: The API behind these functions is down for good, see \code{\link{id_converter}} for similar functionality. + \item \code{\link{cr_search}}: The functionality of this function can + be achieved with the new Crossref API. See functions \code{\link{cr_works}} + et al. + \item \code{\link{cr_search_free}}: The functionality of this function can + be achieved with the new Crossref API. See functions \code{\link{cr_works}} + et al. + \item \code{\link{crosscite}}: The functionality of this function can be + achieved with \code{\link{cr_cn}} + \item \code{\link{cr_fundref}}: Crossref changed their name "fundref" + to "funders", so we've changed our function, see \code{\link{cr_funders}} } } diff --git a/man/rcrossref-deprecated.Rd b/man/rcrossref-deprecated.Rd index cb156c2..b7bb1c0 100644 --- a/man/rcrossref-deprecated.Rd +++ b/man/rcrossref-deprecated.Rd @@ -8,14 +8,22 @@ These functions still work but will be removed (defunct) in the next version. } \details{ \itemize{ - \item \code{\link{cr_search}}: The functionality of this function can - be achieved with the new Crossref API. See functions \code{\link{cr_works}} - et al. - \item \code{\link{cr_search_free}}: The functionality of this function can - be achieved with the new Crossref API. See functions \code{\link{cr_works}} - et al. - \item \code{\link{crosscite}}: The functionality of this function can be - achieved with \code{\link{cr_cn}} + \item \code{\link{cr_ft_text}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{cr_ft_links}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{cr_ft_pdf}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{cr_ft_plain}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{cr_ft_text}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{cr_ft_xml}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{as.tdmurl}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. + \item \code{\link{extract_xpdf}}: This function and other text mining + functions are being incorporated in a new package \code{crminer}. } } diff --git a/man/rcrossref-package.Rd b/man/rcrossref-package.Rd index 89b008f..66c2cea 100644 --- a/man/rcrossref-package.Rd +++ b/man/rcrossref-package.Rd @@ -13,7 +13,8 @@ R Client for Various CrossRef APIs. rcrossref interacts with the main Crossref metadata search API at \url{https://github.com/CrossRef/rest-api-doc/blob/master/rest_api.md}, the old metadata search API at \url{http://search.labs.crossref.org/}, their -DOI Content Negotiation service at \url{http://www.crosscite.org/cn/}, and +DOI Content Negotiation service at +\url{http://citation.crosscite.org/docs.html}, and the \emph{Text and Data Mining} project \url{http://tdmsupport.crossref.org/} } diff --git a/tests/testthat/test_cr_fundref.R b/tests/testthat/test_cr_funders.R similarity index 62% rename from tests/testthat/test_cr_fundref.R rename to tests/testthat/test_cr_funders.R index 4e76a20..c50b955 100644 --- a/tests/testthat/test_cr_fundref.R +++ b/tests/testthat/test_cr_funders.R @@ -1,14 +1,14 @@ -context("testing cr_fundref") +context("testing cr_funders") -test_that("cr_fundref returns", { +test_that("cr_funders returns", { skip_on_cran() - a <- suppressWarnings(cr_fundref(dois=c('10.13039/100000001','10.13039/100000015'))) - b <- suppressWarnings(cr_fundref(dois='10.13039/100000001', works=TRUE, limit=5)) + a <- suppressWarnings(cr_funders(dois=c('10.13039/100000001','10.13039/100000015'))) + b <- suppressWarnings(cr_funders(dois='10.13039/100000001', works=TRUE, limit=5)) # correct clases - expect_is(suppressWarnings(cr_fundref(query="NSF", limit=1)), "list") + expect_is(suppressWarnings(cr_funders(query="NSF", limit=1)), "list") expect_is(a, "list") expect_is(a[[1]]$data, "data.frame") expect_is(a[[1]]$descendants, "character") @@ -21,7 +21,7 @@ test_that("cr_fundref returns", { expect_equal(length(b), 2) }) -test_that("cr_fundref fails correctly", { +test_that("cr_funders fails correctly", { skip_on_cran() library('httr') diff --git a/tests/testthat/test_cr_search.R b/tests/testthat/test_cr_search.R deleted file mode 100644 index 546b8dc..0000000 --- a/tests/testthat/test_cr_search.R +++ /dev/null @@ -1,39 +0,0 @@ -context("testing cr_search") - - -test_that("cr_search returns correct class", { - skip_on_cran() - - a <- suppressWarnings(cr_search(query = c("renear", "palmer"))) - b <- suppressWarnings(cr_search(query = c("renear", "palmer"), rows = 4)) - c <- suppressWarnings(cr_search(query = c("renear", "palmer"), rows = 40)) - d <- suppressWarnings(cr_search(query = c("renear", "palmer"), year = 2010)) - e <- suppressWarnings(cr_search(doi = c("10.1890/10-0340.1","10.1016/j.fbr.2012.01.001", - "10.1111/j.1469-8137.2012.04121.x"))) - - # correct classes - expect_is(a, "data.frame") - expect_is(b, "data.frame") - expect_is(c, "data.frame") - expect_is(d, "data.frame") - expect_is(e, "data.frame") - - expect_is(a, "data.frame") - expect_is(a$title, "character") - expect_is(a$score, "numeric") - - # dimensions are correct - expect_equal(NROW(b), 4) - expect_equal(NROW(c), 40) - expect_equal(NCOL(a), 7) - expect_equal(NCOL(d), 7) - expect_equal(NCOL(e), 7) -}) - -test_that("cr_search fails correctly", { - skip_on_cran() - - library('httr') - expect_error(suppressWarnings(cr_search(config=timeout(0.01)))) - expect_equal(suppressWarnings(cr_search("Asdfadf")), NULL) -}) diff --git a/tests/testthat/test_cr_search_free.R b/tests/testthat/test_cr_search_free.R deleted file mode 100644 index a33b591..0000000 --- a/tests/testthat/test_cr_search_free.R +++ /dev/null @@ -1,40 +0,0 @@ -context("testing cr_search_free") - - -test_that("cr_search_free returns", { - skip_on_cran() - - a <- suppressWarnings(cr_search_free(query = "Piwowar Sharing Detailed Research Data Is Associated with Increased Citation Rate PLOS one 2007")) - b <- suppressWarnings(cr_search_free(query="Renear 2012")) - c <- doi <- suppressWarnings(cr_search_free(query="Piwowar sharing data PLOS one"))$doi - d <- suppressWarnings(cr_search(doi = doi)) - queries <- c("Piwowar sharing data PLOS one", "Priem Scientometrics 2.0 social web", - "William Gunn A Crosstalk Between Myeloma Cells", - "karthik ram Metapopulation dynamics override local limits") - e <- suppressWarnings(cr_search_free(queries)) - - # correct class - expect_is(a, "data.frame") - expect_is(b, "data.frame") - expect_is(c, "character") - expect_is(d, "data.frame") - expect_is(e, "data.frame") - - expect_is(a$score, "numeric") - expect_is(a$match, "logical") - - # dimensions are correct - expect_equal(NCOL(a), 5) - expect_equal(NCOL(b), 3) - expect_equal(length(c), 1) - expect_equal(NCOL(d), 7) - expect_equal(NCOL(e), 5) -}) - -test_that("cr_search_free fails correctly", { - skip_on_cran() - - library('httr') - expect_error(suppressWarnings(cr_search_free(config=timeout(0.01)))) - expect_match(suppressWarnings(cr_search_free("Asdfadf"))$reason, "Too few terms") -}) diff --git a/tests/testthat/test_pmd2doi.R b/tests/testthat/test_pmd2doi.R deleted file mode 100644 index 2882a62..0000000 --- a/tests/testthat/test_pmd2doi.R +++ /dev/null @@ -1,34 +0,0 @@ -# context("testing pmd2doi") - -# a <- doi2pmid("10.1016/0006-2944(75)90147-7") -# b <- doi2pmid("10.1016/0006-2944(75)90147-7", TRUE) -# c <- doi2pmid(c("10.1016/0006-2944(75)90147-7","10.1186/gb-2008-9-5-r89")) -# d <- pmid2doi(18507872) -# e <- pmid2doi(18507872, TRUE) -# f <- pmid2doi(c(1,2,3)) - -# test_that("pmd2doi returns correct class", { -# expect_is(a, "data.frame") -# expect_is(b, "integer") -# expect_is(c, "data.frame") -# expect_is(d, "data.frame") -# expect_is(e, "character") -# expect_is(f, "data.frame") - -# expect_is(a$doi, "character") -# }) - -# test_that("pmd2doi dimensions are correct", { -# expect_equal(NCOL(a), 2) -# expect_equal(length(b), 1) -# expect_equal(NCOL(c), 2) -# expect_equal(NCOL(d), 2) -# expect_equal(length(e), 1) -# expect_equal(NCOL(f), 2) -# }) - -# test_that("pmd2doi fails correctly", { -# library('httr') -# expect_error(pmid2doi()) -# expect_error(pmid2doi(18507872, config=timeout(0.01))) -# }) diff --git a/vignettes/crossref_vignette.Rmd b/vignettes/crossref_vignette.Rmd index 7b834e5..864dcac 100644 --- a/vignettes/crossref_vignette.Rmd +++ b/vignettes/crossref_vignette.Rmd @@ -29,7 +29,7 @@ library("rcrossref") ## Citation search -CrossRef's [DOI Content Negotiation](http://www.crosscite.org/cn/) service, where you can citations back in various formats, including `apa` +CrossRef's [DOI Content Negotiation](http://citation.crosscite.org/docs.html) service, where you can citations back in various formats, including `apa` ```r @@ -112,7 +112,7 @@ There are two functions that use an older Crossre API: `cr_search()` and `cr_sea ```r -cr_fundref(query="NSF") +cr_funders(query="NSF") ``` ``` @@ -121,19 +121,19 @@ cr_fundref(query="NSF") #> 1 8 NSF 0 20 #> #> $data -#> Source: local data frame [8 x 6] -#> +#> # A tibble: 8 × 6 #> id location -#> (chr) (chr) -#> 1 501100000930 Australia -#> 2 100000001 United States -#> 3 100003187 United States -#> 4 100008367 Denmark -#> 5 501100004190 Norway -#> 6 100000179 United States -#> 7 100006445 United States +#> +#> 1 100003187 United States +#> 2 100008367 Denmark +#> 3 501100004190 Norway +#> 4 100000179 United States +#> 5 100006445 United States +#> 6 501100000930 Australia +#> 7 100000001 United States #> 8 501100001809 China -#> Variables not shown: name (chr), alt.names (chr), uri (chr), tokens (chr) +#> # ... with 4 more variables: name , alt.names , uri , +#> # tokens ``` ### Check the DOI minting agency