cdbAddAttachment {R4CouchDB} | R Documentation |
Add attachments
Description
This function adds attachments to a database document that already exists.
Usage
cdbAddAttachment(cdb)
Arguments
cdb |
The list |
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 |
Author(s)
wactbprot
Examples
## 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)
[Package R4CouchDB version 0.7.5 Index]