_ _ _ _ _ _ _ _ _ _ _
 /|                   |\
/ |_ _ _ _ _ _ _ _ _ _| \
\ /                    \/
 \ ___________________ /

An easy interface to CouchDB from R

Note: Check out R4couchdb, another R package to interact with CouchDB.

CouchDB versions

sofa is built targeting CouchDB v2 or greater.

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.

You can interact with your CouchDB databases as well in your browser. Navigate to http://localhost:5984/_utils

Install sofa

From CRAN

Development version from GitHub

devtools::install_github("ropensci/sofa")
library('sofa')

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:

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 or https
  • port: The port to connect to. Default: 5984. For Cloudant, have to set to NULL
  • 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.

Create a new database, and list available databases

#> $ok
#> [1] TRUE
db_create(x, dbname = 'sofadb')
#> $ok
#> [1] TRUE

see if its there now

More docs

See the vignettes for more documentation.

Meta

ropensci_footer