Skip to contents

Repository listings are cached for the session (keyed by URL and recursive), so repeated calls do not re-query the OSF API; clear the cache with osf_cache_clear() or disable it with options(metacheck.osf.cache = FALSE).

Usage

osf_info(osf_url, id_col = 1, recursive = FALSE, pb = NULL, cache = FALSE)

Arguments

osf_url

an OSF ID or URL, or a table containing them

id_col

the index or name of the column that contains OSF IDs or URLs, if id is a table

recursive

whether to retrieve all children

pb

a progress bar passed from another function

cache

if TRUE, also reuse a PERSISTENT, on-disk cached listing per id (see repo_info_cache_clear()) that survives a restart of the script – separate from, and in addition to, this function's own in-memory, session-only cache described above. Off by default.

Value

a data frame of information

Examples

# \donttest{
if (online("api.osf.io")) {
  # get info on one OSF node
  osf_info("pngda")

  # also get child nodes and files
  osf_info("https://osf.io/6nt4v", recursive = TRUE)
}
#>                osf_url                   osf_id               name
#> 1 https://osf.io/6nt4v                    6nt4v     Processed Data
#> 2                 <NA> 6846ec9ae295bf0267199776         osfstorage
#> 3                 <NA> 6846ed6a29684b023953943e processed-data.csv
#>          description osf_type public category registration preprint
#> 1 The processed data    nodes   TRUE     data        FALSE    FALSE
#> 2               <NA>    files     NA     <NA>           NA       NA
#> 3               <NA>    files     NA     <NA>           NA       NA
#>                                                    self
#> 1                    https://api.osf.io/v2/nodes/6nt4v/
#> 2                                                  <NA>
#> 3 https://api.osf.io/v2/files/6846ed6a29684b023953943e/
#>                                      children
#> 1 https://api.osf.io/v2/nodes/6nt4v/children/
#> 2                                        <NA>
#> 3                                        <NA>
#>                                                 files                   parent
#> 1            https://api.osf.io/v2/nodes/6nt4v/files/                    ckjef
#> 2 https://api.osf.io/v2/nodes/6nt4v/files/osfstorage/                    6nt4v
#> 3                                                <NA> 6846ec9ae295bf0267199776
#>   project   provider   kind filetype size downloads                path
#> 1   pngda       <NA>   <NA>     <NA>   NA        NA                <NA>
#> 2   6nt4v osfstorage folder     <NA>   NA        NA                   /
#> 3   6nt4v osfstorage   file     data  185       490 /processed-data.csv
#>                     download_url
#> 1                           <NA>
#> 2                           <NA>
#> 3 https://osf.io/download/75qgk/
# }