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 = "Io1bwAiOjB1jPgUNegjJhJxF",
    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     176
#> 2 EFYP9975     176
#> 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 JP5JWKDI       0 FALSE           
#> 2 Z8D3SF6D       0 JP5JWKDI        
#> 3 CZ8PQ9AR       0 Z8D3SF6D        
#> 4 527NK32U       0 CZ8PQ9AR        
#> 5 IEZZEJY6       0 527NK32U        

  # 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 BEM2487T       0
#> 2 DCGJMVB4       0
#> 3 F36J5KIP       0
# }