Skip to contents

Replace key identifiers with new ones while keeping existing structure and relationship between collections and items

Usage

ZoteroCopy(
  zotero,
  copy.collections = TRUE,
  copy.items = TRUE,
  copy.extras = TRUE,
  remove.missing = TRUE,
  change.library = FALSE,
  copy.user = TRUE,
  copy.id = NULL,
  copy.api = NULL,
  silent = FALSE
)

Arguments

zotero

A list with information on the specified Zotero library (e.g., id, API key, collections, and items)

copy.collections

Try to copy specified collections, Default: TRUE

copy.items

Try to copy specified items?, Default: TRUE

copy.extras

Try to copy specified extras (i.e., attachments and notes)?, Default: TRUE

remove.missing

Deleted missing extras, Default: TRUE

change.library

Stage changing of library (e.g., from a group to a personal library), Default: FALSE

copy.user

New user type (The functions will use `group` as prefix if FALSE), Default: TRUE

copy.id

New id, Default: NULL

copy.api

New API key, Default: NULL

silent

c2z is noisy, tell it to be quiet, Default: FALSE

Value

A list with information on the specified Zotero library (e.g., copied collections and items)

Details

Please see https://oeysan.github.io/c2z/

Examples

# \donttest{
  # Fetching collections and items from default group
  zotero = Zotero(
    user = FALSE,
    id = "4827927",
    api = "RqlAmlH5l1KPghfCseAq1sQ1",
    library = TRUE
  )
#> Searching for collections 
#> Found 5 collections 
#> The Zotero list contains: 5 collections, 0 items, and 0 attachments 
#> Searching for all items in library 
#> Found 3 items 
#> The Zotero list contains: 5 collections, 3 items, and 0 attachments 

  # Display collections
  if (any(nrow(zotero$collections))) {
    zotero$collections |>
      dplyr::select(key, version, parentCollection) |>
      print(width = 80)
  }
#> # A tibble: 5 × 3
#>   key      version parentCollection
#>   <chr>      <int> <chr>           
#> 1 Z7UY2AMH     173 5CYJY58A        
#> 2 4U4Q3ING     173 F5TXCJZX        
#> 3 MUFMB89Y     173 Z7UY2AMH        
#> 4 5CYJY58A     173 4U4Q3ING        
#> 5 F5TXCJZX     173 FALSE           

  # Display items
  if (any(nrow(zotero$items))) {
    zotero$items |>
      dplyr::select(key, version) |>
      print(width = 80)
  }
#> # A tibble: 3 × 2
#>   key      version
#>   <chr>      <int>
#> 1 E4V6GUCV     174
#> 2 EFYP9975     174
#> 3 5CXYJP68     174

  # Copy items
  example <- ZoteroCopy(
    zotero,
  )
#> Copying collections 
#> Copying items 

  # Display collections
  if (any(nrow(example$collections))) {
    example$collections |>
      dplyr::select(key, version, parentCollection) |>
      print(width = 80)
  }
#> # A tibble: 5 × 3
#>   key      version parentCollection
#>   <chr>      <dbl> <chr>           
#> 1 DIEZZEJY       0 IBEM2487        
#> 2 6CZ8PQ9A       0 TDCGJMVB        
#> 3 RJP5JWKD       0 DIEZZEJY        
#> 4 IBEM2487       0 6CZ8PQ9A        
#> 5 TDCGJMVB       0 FALSE           

  # Display items
  if (any(nrow(example$items))) {
    example$items |>
      dplyr::select(key, version) |>
      print(width = 80)
  }
#> # A tibble: 3 × 2
#>   key      version
#>   <chr>      <dbl>
#> 1 4F36J5KI       0
#> 2 PXVBQARB       0
#> 3 AKRVGPXC       0
# }