ropensci / handlr

convert among citation formats
https://docs.ropensci.org/handlr
Other
38 stars 4 forks source link

a feature request - make it possible to convert a handlr object to a data frame #15

Closed GeraldCNelson closed 4 years ago

GeraldCNelson commented 5 years ago

I'd like to request a function to convert a handl object into a data frame. There are times when I'd would like to be able to scan through a large set of references. Or pull out a column like the DOIs. Thanks for considering this!

sckott commented 5 years ago

thanks for this @GeraldCNelson

just to make sure we're on the same page, you are referring only to the handl object, and not to other outputs?

GeraldCNelson commented 5 years ago

Scott, I'm not sure I understand the details of the package well enough to give you a definitive answer. Here's my situation. I'm one of the lead authors on an IPCC chapter for AR6. We are supposed to assess the literature on climate change and topic x, where x is food security in my case. I have published a fair amount in my particular area of expertise. But I can't claim to know all the literature. So the process we're going through is to use various reference data bases - SCOPUS and Web of Science in particular, and then do so classification, both automatically (e.g., citation count > 3 and language = English,French). SCOPUS has a cvs output that lets us do the filtering but I can't figure out if WoS does. However both do .ris and .bib files. So I can read in these. Here's an example temp <- ris_reader(x = "~/Downloads/consumption_14.ris")

consumption_14.ris is a 2.6 MB .ris file. temp is an 840 Mb handl object. It looks like basically a list for each reference with each list having the same components. I have attached a zipped csv file that comes out from SCOPUS. What I'm looking for is a way to convert .ris or .bib files to this type of csv file. I'm guessing that the handlr object can be converted to a data frame or table that could then be saved to a csv (or other) file format. financialization.csv.zip

sckott commented 5 years ago

Thanks for the clarifications @GeraldCNelson It helps to know what the use case is.

I'll have a look and get back to you soon

sckott commented 5 years ago

@GeraldCNelson after reinstalling remotes::install_github("ropensci/handlr@handl-to-df"), reload R, and try examples:

library(handlr)
z <- system.file('extdata/crossref.ris', package = "handlr")
x <- HandlrClient$new(x = z)
x$as_df() # empty data.frame
x$read()
x$as_df() # data.frame with citation data

# one citation
z <- system.file('extdata/crossref.ris', package = "handlr")
res <- ris_reader(z)
handl_to_df(res)

# many citations
z <- system.file('extdata/bib-many.bib', package = "handlr")
res2 <- bibtex_reader(x = z)
handl_to_df(res2)
sckott commented 4 years ago

fixed #19