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

Commit

Permalink
fixed mendeley parsing in events data, closes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Feb 7, 2015
1 parent 1535c43 commit 2c94b1b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions R/alm_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,18 @@ alm_events <- function(doi = NULL, pmid = NULL, pmcid = NULL, mendeley_uuid = NU
} else if(y$name == "mendeley"){
if(length(y$events)==0){paste(sorry)} else
{
parsemendeley <- function(mm){
readers <- data.frame(name="readers", value=mm$readers, stringsAsFactors = FALSE)
disc <- if(length(mm$discipline) > 1){
ldply(mm$discipline, function(x) data.frame(x, stringsAsFactors = FALSE))[,-1]
} else { data.frame(mm$discipline, stringsAsFactors = FALSE)[,-1] }
country <- ldply(mm$country, function(x) data.frame(x, stringsAsFactors = FALSE))
status <- ldply(mm$status, function(x) data.frame(x, stringsAsFactors = FALSE))
dfs <- list(readers = readers, discipline = disc, country = country, status = status)
ldply(dfs)
}
df <- parsemendeley(y$events)
list(events_url=y$events_url, events=df, csl=y$events_csl)
# parsemendeley <- function(mm){
# readers <- data.frame(name="readers", value=mm$readers, stringsAsFactors = FALSE)
# disc <- if(length(mm$discipline) > 1){
# ldply(mm$discipline, function(x) data.frame(x, stringsAsFactors = FALSE))[,-1]
# } else { data.frame(mm$discipline, stringsAsFactors = FALSE)[,-1] }
# country <- ldply(mm$country, function(x) data.frame(x, stringsAsFactors = FALSE))
# status <- ldply(mm$status, function(x) data.frame(x, stringsAsFactors = FALSE))
# dfs <- list(readers = readers, discipline = disc, country = country, status = status)
# ldply(dfs)
# }
# df <- parsemendeley(y$events)
list(events_url=y$events_url, events=y$events, csl=y$events_csl)
}
} else if(y$name == "twitter"){
if(length(y$events)==0){paste(sorry)} else
Expand Down

0 comments on commit 2c94b1b

Please sign in to comment.