repo_put {repo} | R Documentation |
Create a new item in the repository.
Description
Given an R object, stores it to an RDS file in the repo
root
and add an associated item to the repo
index, including
object name, description, tags and more.
Usage
repo_put(
obj,
name = NULL,
description = NULL,
tags = NULL,
prj = NULL,
src = NULL,
chunk = name,
depends = NULL,
replace = F,
asattach = F,
to = NULL,
addversion = F,
URL = NULL,
checkRelations = T
)
Arguments
obj |
An R object to store in the repo. |
name |
A character identifier for the new item. If NULL, the
name of the |
description |
A character description of the item. |
tags |
A list of tags to sort the item. Tags are useful for selecting sets of items and run bulk actions. |
prj |
The name of a |
src |
Name of an existing item to be annotated as the "generator" of the new item. Usually it is an attachment item containing the source code that generated the new item. Default is NULL. |
chunk |
The name of the code chunk within |
depends |
Character vector: items that depend on this item. Default is NULL. |
replace |
One of: V, F, "addversion" to define behavior when an item by the same name exists. If V, overwrite it. If F stop with an error. If "addversion" the new item is stored as a new version and the old item is renamed by appending a "#N" suffix. Default is F. |
asattach |
Specifies that the item is to be treated as an attachment (see attach). Default is F. |
to |
Vector of character. Specifies which item this item is attached to. Default is NULL. |
addversion |
Deprecated, use the |
URL |
Remote URL where the |
checkRelations |
Check if items referenced by this item exist. Default is T. |
Details
The item name
can be any string, however it should
be a concise identifier, possibly without special character
(could become mandatory soon). Some tags have a special
meaning, like "hide" (do not show the item by default),
"attachment" (the item is an attachment - this should never be
set manually), "stash" (the item is a stashed item, makes the
item over-writable by other "stash" items by default).
Value
Used for side effects.
See Also
get, set, attach, info
Examples
## Repository creation
rp_path <- file.path(tempdir(), "example_repo")
rp <- repo_open(rp_path, TRUE)
## Producing some irrelevant data
data1 <- 1:10
data2 <- data1 * 2
data3 <- data1 / 2
## Putting the data in the database, specifying dependencies
rp$put(
obj = data1,
name = "item1",
description = "First item",
tags = c("repo_put", "a_random_tag"),
)
rp$put(data2, "item2", "Item dependent on item1",
"repo_dependencies", depends="item1")
rp$put(data3, "item3", "Item dependent on item1 and item2",
"repo_dependencies", depends=c("item1", "item2"))
print(rp)
## Creating another version of item1
data1.2 <- data1 + runif(10)
rp$put(data1.2, name = "item1", "First item with additional noise",
tags = c("repo_put", "a_random_tag"), replace="addversion")
print(rp, all=TRUE)
rp$info("item1#1")
## wiping temporary repo
unlink(rp_path, TRUE)