2. Data Search and Discovery

2021-03-07

Searching for data within Dataverse is quite easy using the dataverse_search() function. The simplest searches simply consist of a query string:

library("dataverse")
Sys.setenv("DATAVERSE_SERVER" = "dataverse.harvard.edu")
dataverse_search("Gary King")[c("name")]
## 10 of 1295 results retrieved
##                                                                                                                           name
## 1                                                                                        00698McArthur-King-BoxCoverSheets.pdf
## 2                                                                                       00698McArthur-King-MemoOfAgreement.pdf
## 3                                                                                      00698McArthur-King-StudyDescription.pdf
## 4          01 ReadMe Unlocking history through automated virtual unfolding of sealed documents imaged by X-ray microtomography
## 5                                                                                07 Letterlocking Categories and Formats Chart
## 6  10 Foldable: Launch Little Book of Locks (UH6089), with Categories and Formats Chart. Letterlocking Instructional Resources
## 7                                                                                       10 Million International Dyadic Events
## 8                                                                            1479 data points of covid19 policy response times
## 9                                                              1998 Jewish Community Study of the Coachella Valley, California
## 10                                                                                               2002 State Legislative Survey

The results are paginated, so users can rely upon the per_page and start argument to requested subsequent pages of results. We’ll start at 6 and to show that we retrieve the last five results from the previous query plus 15 more (due to per_page = 20):

dataverse_search("Gary King", start = 6, per_page = 20)[c("name")]
## 20 of 1295 results retrieved
##                                                                                                                                            name
## 1                                                                                                        10 Million International Dyadic Events
## 2                                                                                             1479 data points of covid19 policy response times
## 3                                                                               1998 Jewish Community Study of the Coachella Valley, California
## 4                                                                                                                 2002 State Legislative Survey
## 5                                                                                            2007 White Sands Dune Field lidar topographic data
## 6                                                                                            2008 White Sands Dune Field lidar topographic data
## 7                                      A Comparative Analysis of Brazil's Foreign Policy Drivers Towards the USA: Comment on Amorim Neto (2011)
## 8                                                                      A Demographic and Attitudinal Study of the Jewish Community of St. Louis
## 9                                                                          A Demographic Study of the Jewish Community of Atlantic County, 1985
## 10                                                                           A Demographic Study of the Jewish Community of Greater Kansas City
## 11                                                                      A Demographic Study of the Jewish Community of Greater Washington, 1983
## 12                                                       A Framework to Quantify the Signs of Abandonment in Online Digital Humanities Projects
## 13                                                                                                      A Lexicial Index of Electoral Democracy
## 14                                                                          A Population Study of the Jewish Community of Metrowest, New Jersey
## 15                                                                                A Population Study of the Jewish Community of Rochester, 1986
## 16                                                                                      A Population Study of the Jewish Community of Worcester
## 17                                                                                                    A Study of Jewish Culture in the Bay Area
## 18 A survey of experiences of and attitudes to advance decision-making amongst people with bipolar: questionnaire and supplementary information
## 19                                                                          A Unified Model of Cabinet Dissolution in Parliamentary Democracies
## 20                                                                   ABC News / The Washington Post poll # 7925:  Social Security/1984 Election

More complicated searches can specify metadata fields like title and restrict results to a specific type of Dataverse object (a “dataverse”, “dataset”, or “file”):

ei <- dataverse_search(author = "Gary King", title = "Ecological Inference", type = "dataset", per_page = 20)
## 20 of 1203 results retrieved
# fields returned
names(ei)
# names of datasets
ei$name
##  [1] "name"                    "type"                    "url"                     "global_id"              
##  [5] "description"             "published_at"            "publisher"               "citationHtml"           
##  [9] "identifier_of_dataverse" "name_of_dataverse"       "citation"                "storageIdentifier"      
## [13] "keywords"                "subjects"                "fileCount"               "versionId"              
## [17] "versionState"            "majorVersion"            "minorVersion"            "createdAt"              
## [21] "updatedAt"               "contacts"                "authors"                 "publications"           
## [25] "geographicCoverage"      "producers"               "dataSources"            
##  [1] "01 ReadMe Unlocking history through automated virtual unfolding of sealed documents imaged by X-ray microtomography"                                                               
##  [2] "07 Letterlocking Categories and Formats Chart"                                                                                                                                     
##  [3] "10 Foldable: Launch Little Book of Locks (UH6089), with Categories and Formats Chart. Letterlocking Instructional Resources"                                                       
##  [4] "10 Million International Dyadic Events"                                                                                                                                            
##  [5] "1479 data points of covid19 policy response times"                                                                                                                                 
##  [6] "3D Dust map from Green et al. (2015)"                                                                                                                                              
##  [7] "3D dust map from Green et al. (2017)"                                                                                                                                              
##  [8] "3D dust map from Green et al. (2019)"                                                                                                                                              
##  [9] "A 1D Lyman-alpha Profile Camera for Plasma Edge Neutral Studies  on the DIII-D Tokamak"                                                                                            
## [10] "A Comparative Analysis of Brazil's Foreign Policy Drivers Towards the USA: Comment on Amorim Neto (2011)"                                                                          
## [11] "A Critique of Dyadic Design"                                                                                                                                                       
## [12] "A Framework to Quantify the Signs of Abandonment in Online Digital Humanities Projects"                                                                                            
## [13] "A Lexicial Index of Electoral Democracy"                                                                                                                                           
## [14] "A Replication of ‘The long-run impact of foreign aid in 36 African countries: Insights from multivariate time series analysis’ (Oxford Bulletin of Statistics and Economics, 2014)"
## [15] "A Statistical Inference Engine for Small, Dependent Samples  [Version 2.310]"                                                                                                      
## [16] "A survey of experiences of and attitudes to advance decision-making amongst people with bipolar: questionnaire and supplementary information"                                      
## [17] "A Unified Model of Cabinet Dissolution in Parliamentary Democracies"                                                                                                               
## [18] "ABC News / The Washington Post poll # 7925:  Social Security/1984 Election"                                                                                                        
## [19] "ABC News Iraq Poll, August 1990"                                                                                                                                                   
## [20] "ABC News/The Washington Post Poll:  Los Angeles Race Riots"

Once datasets and files are identified, it is easy to download and use them directly in R. See the “Data Download” vignette for details.