An easy interface to CouchDB from R
sofa docs: https://docs.ropensci.org/sofa/
CouchDB versions
sofa
works with CouchDB v2 and v3. See the builds for checks on various CouchDB versions.
Connect to CouchDB
This may be starting it on your terminal/shell
Or opening the CouchDB app on your machine, or running it in Docker. Whatever it is, start it up.
Cushions
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 url -
transport
:http
orhttps
-
port
: The port to connect to. Default: 5984. For Cloudant, have to set toNULL
-
user
: User name for the service. -
pwd
: Password for the service, if any. -
headers
: headers to pass in all requests
If you call Cushion$new()
with no arguments you get a cushion set up for local use on your machine, with all defaults used.
Ping the server
Nice, it’s working.
More
See the docs https://docs.ropensci.org/sofa/ for more.
Meta
- Please report any issues or bugs.
- License: MIT
- Get citation information for
sofa
in R doingcitation(package = 'sofa')
- Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.