| docdb_create | R Documentation |
A message is emitted if the container key already exists.
docdb_create(src, key, value, ...)
src |
Source object, result of call to any of functions
|
key |
(character) The name of the container in the
database backend (corresponds to |
value |
The data to be created in the database: a single data.frame, a JSON string, a list, or a file name or URL that points to NDJSON documents |
... |
Passed to functions |
An error is raised for document(s) in value when their
_id already exist(s) in the collection key;
use docdb_update() to update such document(s).
(integer) Number of successfully created documents
If value is a data.frame that has a column _id,
or is a JSON string having a key _id at root level,
or is a list having an item _id at its top level,
this will be used as _id's and primary index
in the database. If there are no such _id's in value,
row names (if any exist) of value will be used as _id's,
otherwise random _id's will be created (using
uuid::UUIDgenerate() with use.time = TRUE for
SQLite and PostgreSQL, or using DuckDB's built-in uuid()).
## Not run:
src <- src_sqlite()
docdb_create(src,
key = "diamonds_small",
value = as.data.frame(diamonds[1:3000L, ])
)
head(docdb_get(src, "diamonds_small"))
docdb_create(src, key = "contacts", value = contacts)
docdb_get(src, "contacts")[["friends"]]
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.