repo_attach {repo} | R Documentation |
Create a new item from an existing file.
Description
Create a new item from an existing file.
Usage
repo_attach(
filepath,
description = NULL,
tags = NULL,
prj = NULL,
src = NULL,
chunk = basename(filepath),
replace = F,
to = NULL,
URL = NULL
)
Arguments
filepath |
The path to the file to be stored in the repo. |
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 |
The name of the item that produced the stored object. Usually a previously attached source code file. |
chunk |
The name of the code chunk within |
replace |
If the item exists, overwrite the specified fields. |
to |
An existing item name to attach the file to. |
URL |
A URL where the item contents con be downloaded from. |
Value
Used for side effects.
Examples
rp_path <- file.path(tempdir(), "example_repo")
rp <- repo_open(rp_path, TRUE)
## Not run:
## Creating a PDF file with a figure.
pdf("afigure.pdf")
## Drawing a random plot in the figure
plot(runif(100), runif(100))
dev.off()
## Attaching the PDF file to the repo
rp$attach("afigure.pdf", "A plot of random numbers", "repo_sys")
## don't need the PDF file anymore
file.remove("afigure.pdf")
## Opening the stored PDF with Evince document viewer
rp$sys("afigure.pdf", "evince")
## End(Not run)
## wiping temporary repo
unlink(rp_path, TRUE)
[Package repo version 2.1.5 Index]