This function allows to download all publicly available versions of Metapsy databases into your R environment.
Arguments
- shorthand
character
. The shorthand assigned to the database that should be downloaded. Shorthands are listed under "Metadata" in the database documentation entry. Alternatively, all available databases and their shortcodes can be accessed by runninglistData()
.- version
character
. The version number to be downloaded. Default isNULL
, which downloads the latest version.- include.metadata
logical
. If set toTRUE
, the function will return an R6Class object that includes metadata associated with the database version. See "Value".
Value
If include.metadata
is set to TRUE
, the getData
function
will return both the requested dataset itself, as well as the metadata associated
within in it. Metadata items included by default are:
database.doi
: The digital object identifier of the database ("Concept DOI" in the Zenodo API. This DOI will always resolve to the latest database version).documentation.url
: URL of the database documentation entry on the Metapsy Documentation page.github.repo.url
: URL of the specific Github repository state at which the database was released.last.search
: Date of the last search.last.updated
: Date of the last database updated (release).license
: License of the database.repository.download.url
: Link to download the entire database from Zenodo.title
: Title of the database (including its version).variable.description
: Description of the variables included in the dataset.version
: Version of the database.version.doi
: DOI associated with the specific version of the database. In contrast to thedatabase.doi
, this identifier will also link to this specific database version.
The returned R6::R6Class()
object also contains a few helpful functions,
which can be called directly from the object:
downloadZip()
: This will download the database (including metadata) as a .zip file from its Zenodo repository.openDocumentation()
: This opens the database documentation entry on the Metapsy Documentation page.openGitRepo()
: This opens the Github repository of the database at the state of its release.returnMetadata()
: Returns the entire metadata stored in themetapsyDatabase
R6 object as alist
.variableDescription()
: This prints a variable description of the database in the R Console.
If include.metadata
is FALSE
, the function will return the dataset
as a simple data.frame
.
Author
Mathias Harrer mathias.h.harrer@gmail.com
Examples
if (FALSE) {
# List all available databases
listData()
# Get latest version of the 'depression-psyctr' database
d <- getData("depression-psyctr")
# Get version 22.2.0 of the 'depression-psyctr' database
d <- getData("depression-psyctr", "22.2.0")
# Show variable description
d$variableDescription()
# Open online documentation
d$openDocumentation()
# Analyze using metapsyTools
library(metapsyTools)
runMetaAnalysis(d)
}