cdbAddAttachment: Add attachments

Description Usage Arguments Details Value Author(s) Examples

Description

This function adds attachments to a database document that already exists.

Usage

1

Arguments

cdb

The list cdb has to contain cdb$fileName,cdb$serverName, cdb$DBName and a cdb$id.

Details

The function uses the RCurl- function guessMIMEType() to do exactly this: guessing the mime type of cdb$fileName.

If the switch cdb$attachmentsWithPath is set to TRUE the attachment is saved with the path. This behavior is default since version 0.2.5 of R4CouchDB

Value

cdb

The result is stored in cdb$res

Author(s)

wactbprot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
ccc            <- cdbIni(DBName="r4couch_db")
ccc$dataList   <- list(normalDistRand =  rnorm(20))
ccc            <- cdbAddDoc(ccc)
# make a 3d plot (stolen from ?persp)
x              <- seq(-10, 10, length= 30)
y              <- x
f              <- function(x,y) {r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z              <- outer(x, y, f)

z[is.na(z)]    <- 1
op             <- par(bg = "black")
ccc$fileName   <- "3dplot.pdf"

pdf(ccc$fileName)
persp(x, y, z,
      theta = 30,
      phi = 30,
      expand = 0.5,
      col = "lightblue")
dev.off()
# add the plot as attachment to the database
# it workes over  ccc$fileName
ccc            <- cdbAddAttachment(ccc)

## End(Not run)

R4CouchDB documentation built on May 2, 2019, 6:05 a.m.