Package 'zoteror'

Title: Access the Zotero API in R
Description: zoteror provides tools to access the Zotero API
Authors: Giorgio Comai [aut, cre]
Maintainer: Giorgio Comai <[email protected]>
License: GPL-3
Version: 0.0.0.9005
Built: 2024-11-17 03:54:41 UTC
Source: https://github.com/giocomai/zoteror

Help Index


Add item to a collection

Description

Add item to a collection

Usage

zot_add_to_collection(id, collection_id, user = NULL,
  credentials = NULL)

Arguments

id

Id code of a zotero item

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

A list including all available details on a given item.

Examples

item <- zot_add_to_collection(id = "<itemId>", collection_id = "<collection_id>")

Authenticate to a Zotero account

Description

Authenticate to a Zotero account (get keys)

Usage

zot_auth(cache = TRUE)

Arguments

cache

Logical, defaults to TRUE If TRUE, it stores the credentials in the working diretory in a file called "zotero_credentials.rds", which should be considered confidential since it provides access to a given Zotero account.

Details

The verification code that appears at the end of the URL after authorization in browser should be input as verification PIN. If the parametere cache is enabled - zot_auth(cache=TRUE) - zoteroR stores the credentials in a local file called "zotero_credentials.rds", which should be considered confidential since it provides access to a given Zotero account. If a pre-existing "zotero_credentials.rds" exists, it is loaded automatically.

Value

A OAuth object including the Zotero API key.

Examples

credentials <- zot_auth(cache=TRUE)

Transform a characther vectors of creators (authors, etc.) into a list of properly categorised data frames

Description

Transform a characther vectors of creators (authors, etc.) into a list of properly categorised data frames

Usage

zot_convert_creators_to_df_list(creator, creator_type = "author",
  separator_multiple_authors = "; ", separator_surname_name = ", ")

Arguments

creator

A character vector (usually, a column in a data frame). Names must be given in the format: "Surname, Name; Surname, Name" (use semicolumn only to separate between multiple authors).

creator_type

Defaults to "author". Must be a character vector of length 1.

Value

A data frame, with one column for each accepted input for the given item type.

Examples

zot_convert_creators_to_df_list(creator = "Spinelli, Altiero; Rossi, Ernesto")

Transform a characther vectors of creators (authors, etc.) into a list of properly categorised data frames

Description

Transform a characther vectors of creators (authors, etc.) into a list of properly categorised data frames

Usage

zot_convert_tags_to_df_list(tags, separator = "; ")

Arguments

creator

A character vector (usually, a column in a data frame). Names must be given in the format: "Surname, Name; Surname, Name" (use semicolumn only to separate between multiple authors).

creator_type

Defaults to "author". Must be a character vector of length 1.

Value

A data frame, with one column for each accepted input for the given item type.

Examples

zot_convert_tags_to_df(tags = c("economy; history", "economy"))

Create a collection in Zotero

Description

Create a collection in Zotero. If a collection by the same name exists, it does not create a new one, but rather outputs the id of that collection.

Usage

zot_create_collection(collection_name, user = NULL, credentials = NULL)

Arguments

collection_name

Name of the collection to be added

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Details

Creating a collection needs an API with write access

Value

The key of the newly created collection (or of the pre-existing collection, if already one with the same name exists) as a character vector

Examples

key <- zot_create_collection(user = 12345, collection_name = "ZoteroRtest", credentials = "<API>")

Create a template to facilitate import of csv files

Description

Create a template to facilitate import of csv files

Usage

zot_create_csv_template(item_type = "book", cache = TRUE)

Arguments

item_type

Defaults to "book". It must correspond to a valid item type. You can chech which item types are valid with the function 'zot_get_item_types()'

cache

Logical, defaults to TRUE. If TRUE, it stores the template in a "zot_cache" folder in the current working directory.

Value

A data frame, with one column for each accepted input for the given item type.

Examples

book_template_df <- zot_create_csv_template(item_type = "book")

Create new items from a data frame

Description

Create new Zotero items from a data frame

Usage

zot_create_items(item_df, collection = NULL, user = NULL,
  credentials = NULL)

Arguments

item_df

A data frame representing new items. Column names must correspond to 'zoteroR::zot_get_item_template()' for the given item type.

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

Nothing, used for its side effects (creates new items on Zotero)

Examples

item <- zot_create_items(item_df)

Find and show all valid creator types

Description

Find and show all valid creator types

Usage

zot_get_creator_types(item_type = "book", cache = TRUE,
  locale = NULL)

Arguments

cache

Logical, defaults to TRUE. If TRUE, it stores the list of valid item types in a "zot_cache" folder in the current working directory.

locale

Defaults to English. If given, it should correspond to a language code such as "it" or "fr-FR"

Value

A list including all valid creator types for given item type.

Examples

creator_types <- zot_get_creator_types()

Get an item template for a valid item type

Description

Get an item template for a valid item type

Usage

zot_get_item_template(item_type = "book", cache = TRUE)

Arguments

item_type

Defaults to "book". It must correspond to a valid item type. You can chech which item types are valid with the function 'zot_get_item_types()'

cache

Logical, defaults to TRUE. If TRUE, it stores the template in a "zot_cache" folder in the current working directory.

Value

A list. A template for creating items of the given item_type.

Examples

item_types <- zot_get_item_types()

Find and show all valid item types

Description

Find and show all valid item types

Usage

zot_get_item_types(cache = TRUE, locale = NULL)

Arguments

cache

Logical, defaults to TRUE. If TRUE, it stores the list of valid item types in a "zot_cache" folder in the current working directory.

locale

Defaults to English. If given, it should correspond to a language code such as "it" or "fr-FR"

item_type

Defaults to "book". It must correspond to a valid item type. You can chech which item types are valid with the function 'zot_get_item_types()'

Value

A charachter vector including all categories in which given item is included.

Examples

item_types <- zot_get_item_types()

Find and show all valid fields for a given item type

Description

Find and show all valid fields for a given item type

Usage

zot_get_item_types_fields(item_type = "book", cache = TRUE,
  locale = NULL)

Arguments

item_type

Defaults to "book". It must correspond to a valid item type. You can chech which item types are valid with the function 'zot_get_item_types()'

cache

Logical, defaults to TRUE. If TRUE, it stores the list of valid item types in a "zot_cache" folder in the current working directory.

locale

Defaults to English. If given, it should correspond to a language code such as "it" or "fr-FR"

Value

A data frame including all valid fields for given item type.

Examples

zot_get_item_types_fields()

Read details of all children of a Zotero item

Description

Read details of all children of a Zotero item

Usage

zot_read_children(id, user = NULL, credentials = NULL)

Arguments

id

Id code of a zotero item

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

A data.frame including details on all children of a given parent item.

Examples

item <- ZotReadChildren()

Read IDs of all children of a Zotero item

Description

Read IDs of all children of a Zotero item

Usage

zot_read_children_id(id, user = NULL, credentials = NULL)

Arguments

id

Id code of a zotero item

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

A vector including the ID of all children

Examples

item_id <- zot_read_children_id()

Read details of a Zotero item

Description

Read details of a Zotero item

Usage

zot_read_item(id, user = NULL, credentials = NULL)

Arguments

id

Id code of a zotero item

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

A list including all available details on a given item.

Examples

item <- zot_read_item()

Sets 'zoteroR' options

Description

It allows to preliminary store options frequently used by 'zoteroR', thus removing the requirement to specify them each time a function is called.

Usage

zot_set_options(...)

Arguments

user

A Zotero userId.

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

Nothing. Used for its side effects (stores settings).

Examples

zot_set_options(user = 12345, credentials = <API>)

Find size of zotero objects stored locally

Description

Find size of zotero objects stored locally

Usage

zot_size(path)

Arguments

path

Path to local Zotero storage sub-folde, e.g. "/home/user/.mozilla/firefox/mdk7yirc.default/zotero/storage"

Value

A data.frame (tibble) with ID and size of each item present in the local storage.

Examples

size <- zot_size()

Extract collections in which given item is included

Description

Extract collections in which given item is included

Usage

zot_which_collection(id, user = NULL, credentials = NULL)

Arguments

user

Zotero userId

credentials

Either an R object created with AuthZot(store = TRUE), or an API secret key with write access created at https://www.zotero.org/settings/keys

Value

A charachter vector including all categories in which given item is included.

Examples

categories <- zot_which_collection(item = "X1X2X3")