repo_attach: Create a new item from an existing file.

Description Usage Arguments Value Examples

View source: R/repo_public.R

Description

Create a new item from an existing file.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 project item in the repository (see project). Default is no associated project item.

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 src that is responsible for building the item. Set to name by default. See build.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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)

franapoli/repo documentation built on May 17, 2021, 7:24 p.m.