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

Commit

Permalink
fix #4 return a data.frame from ma_abstract with id as first column a…
Browse files Browse the repository at this point in the history
…nd abstract as 2nd, bump patch ver
  • Loading branch information
sckott committed Jun 19, 2018
1 parent 80bb550 commit 75c75a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Description: The 'Microsoft Academic Knowledge' API provides programmatic access
(<https://academic.microsoft.com/>). Includes methods matching all 'Microsoft
Academic' API routes, including search, graph search, text similarity, and
interpret natural language query string.
Version: 0.3.0.9100
Version: 0.3.1.9100
Authors@R: person("Scott", "Chamberlain", email = "myrmecocystus+r@gmail.com",
role = c("aut", "cre"))
License: MIT + file LICENSE
Expand Down
6 changes: 5 additions & 1 deletion R/abstract.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#'
#' @export
#' @inheritParams ma_search
#' @return data.frame, with two columns: `Id` and `abstract`
#' @examples \dontrun{
#' ma_abstract(query = "Y=2010", count = 10)
#' ma_abstract(query = "Y=[2010, 2012)", count = 10)
Expand All @@ -10,7 +11,10 @@ ma_abstract <- function(query, count = 10, offset = 0, orderby = NULL,
model = "latest", key = NULL, ...) {
out <- ma_evaluate(query, count, offset, orderby, c("Id", "E"),
model, key, ...)
unname(vapply(out$E, function(z) invabs2abs(jsonlite::fromJSON(z)$IA), ""))
tmp <- unname(
vapply(out$E, function(z) invabs2abs(jsonlite::fromJSON(z)$IA), ""))
tibble::as_tibble(data.frame(Id = out$Id, abstract = tmp,
stringsAsFactors = FALSE))
}

invabs2abs <- function(x) {
Expand Down
3 changes: 3 additions & 0 deletions man/ma_abstract.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75c75a1

Please sign in to comment.