SCM Repository

[tm] View of /pkg/man/Source.Rd
ViewVC logotype

View of /pkg/man/Source.Rd

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1482 - (download) (as text) (annotate)
Sat May 20 14:03:21 2017 UTC (13 months ago) by feinerer
File size: 4459 byte(s)
Add alias for getMeta.DataframeSource
  Creating and accessing sources.
SimpleSource(encoding = "",
             length = 0,
             position = 0,
             reader = readPlain,
\method{close}{SimpleSource}(con, \dots)
\method{open}{SimpleSource}(con, \dots)
  \item{x}{A \code{Source}.}
  \item{con}{A \code{Source}.}
  \item{encoding}{a character giving the encoding of the elements delivered by
    the source.}
  \item{length}{a non-negative integer denoting the number of elements delivered
    by the source. If the length is unknown in advance set it to \code{0}.}
  \item{position}{a numeric indicating the current position in the source.}
  \item{reader}{a reader function (generator).}
  \item{\dots}{For \code{SimpleSource} tag-value pairs for storing additional
    information; not used otherwise.}
  \item{class}{a character vector giving additional classes to be used for the
    created source.}
  \emph{Sources} abstract input locations, like a directory, a connection, or
  simply an \R vector, in order to acquire content in a uniform way. In packages
  which employ the infrastructure provided by package \pkg{tm}, such sources are
  represented via the virtual S3 class \code{Source}: such packages then provide
  S3 source classes extending the virtual base class (such as
  \code{\link{DirSource}} provided by package \pkg{tm} itself).

  All extension classes must provide implementations for the functions
  \code{close}, \code{eoi}, \code{getElem}, \code{length}, \code{open},
  \code{reader}, and \code{stepNext}. For parallel element access the
  (optional) function \code{pGetElem} must be provided as well. If
  document level metadata is available, the (optional) function \code{getMeta}
  must be implemented.

  The functions \code{open} and \code{close} open and close the source,
  respectively. \code{eoi} indicates end of input. \code{getElem} fetches the
  element at the current position, whereas \code{pGetElem} retrieves all
  elements in parallel at once. The function \code{length} gives the number of
  elements. \code{reader} returns a default reader for processing elements.
  \code{stepNext} increases the position in the source to acquire the next

  The function \code{SimpleSource} provides a simple reference implementation
  and can be used when creating custom sources.
  For \code{SimpleSource}, an object inheriting from \code{class},
  \code{SimpleSource}, and \code{Source}.

  For \code{getSources}, a character vector with sources provided by package

  \code{open} and \code{close} return the opened and closed source,

  For \code{eoi}, a logical indicating if the end of input of the source is

  For \code{getElem} a named list with the components \code{content} holding the
  document and \code{uri} giving a uniform resource identifier (e.g., a file
  path or \acronym{URL}; \code{NULL} if not applicable or unavailable). For
  \code{pGetElem} a list of such named lists.

  For \code{length}, an integer for the number of elements.

  For \code{reader}, a function for the default reader.
  \code{\link{DataframeSource}}, \code{\link{DirSource}},
  \code{\link{URISource}}, \code{\link{VectorSource}}, and
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge