The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Type: Package
Title: 'PoetryDB' API Wrapper
Version: 1.1.0
Author: Aaron Schlegel
Maintainer: Aaron Schlegel <aaron@aaronschlegel.me>
Description: Wrapper for the 'PoetryDB' API http://poetrydb.org that allows for interaction and data extraction from the database in an R interface. The 'PoetryDB' API is a database of poetry and poets implemented with 'MongoDB' to enable developers and poets to easily access one of the most comprehensive poetry databases currently available.
License: GPL-2
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.0.1
VignetteBuilder: knitr
Suggests: testthat, knitr, rmarkdown, jsonlite, httr, stringr
NeedsCompilation: no
Packaged: 2019-08-19 18:01:10 UTC; aaronschlegel
Repository: CRAN
Date/Publication: 2019-08-19 18:30:06 UTC

Primary function for interfacing with the PoetryDB API.

Description

Primary function for interfacing with the PoetryDB API.

Usage

get.poetry(input_term, search_term = NULL, output = NULL,
  output_format = NULL, search_type = NULL)

Arguments

input_term

The desired input term for searching PoetryDB. Must be one of or any combination of 'author', 'title', 'lines', or 'linecount'.

search_term

Relates to the 'input_term'. The search term should be relevant to the given input term. If multiple 'input_term' parameters are given, each must have a corresponding 'search_term'.

output

Can be any or a combination of the input terms 'author', 'title', 'lines', 'linecount'. If NULL, all the data returned from PoetryDB by the search will be returned. The output can also be a combination of the terms, for example, an output of 'author,title,lines,linecount', will return the same result as if the parameter is set to NULL. An output of 'title,lines', will return the poem's title and text.

output_format

If NULL or 'json', the results are returned in JSON format (the PoetryDB API default). If 'text', the results are returned as a parsed string using the [stringr](https://CRAN.R-project.org/package=stringr) package.

search_type

If NULL (default), the search attempts to match any part of the ‘input_term'. If ’abs', the search will attempt to find an exact match when searching for the 'input_term'.

Value

Search result returned by the PoetryDB API interface in either a JSON-like object or text (depending on what is passed in the 'output_format').

Examples


# Get all of William Shakespeare's poetry by title and lines
shakespeare <- get.poetry('author', 'William Shakespeare', 'title,lines')
# Get all ten books of Paradise Lost written by John Milton by linecount and lines
paradise_lost <- get.poetry('title', 'Paradise Lost', 'linecount,lines')

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.