An easy interface to CouchDB from R
Note: Check out R4couchdb, another R package to interact with CouchDB.
sofa docs: https://docs.ropensci.org/sofa/
sofa works with CouchDB v2 and v3. See the
builds for checks on various CouchDB versions.
This may be starting it on your terminal/shell
couchdbOr opening the CouchDB app on your machine, or running it in Docker. Whatever it is, start it up.
From CRAN
install.packages("sofa")Development version from GitHub
remotes::install_github("ropensci/sofa")library('sofa')Cushions? What? Since it’s couch we gotta use cushions
somehow. cushions are a connection class containing all
connection info to a CouchDB instance. See ?Cushion for
help.
As an example, connecting to a Cloudant couch:
z <- Cushion$new(
host = "stuff.cloudant.com",
transport = 'https',
port = NULL,
user = 'foobar',
pwd = 'things'
)Break down of parameters:
host: the base url, without the transport
(http/https)path: context path that is appended to the end of the
urltransport: http or httpsport: The port to connect to. Default: 5984. For
Cloudant, have to set to NULLuser: User name for the service.pwd: Password for the service, if any.headers: headers to pass in all requestsIf you call Cushion$new() with no arguments you get a
cushion set up for local use on your machine, with all defaults
used.
x <- Cushion$new()Ping the server
x$ping()Nice, it’s working.
See the docs https://docs.ropensci.org/sofa/ for more.
sofa in R doing
citation(package = 'sofa')